This repository has been archived by the owner on Oct 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingHostContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) | ||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) | ||
|
||
using System; | ||
using ICSharpCode.SharpDevelop.Project; | ||
|
||
namespace ICSharpCode.TextTemplating | ||
{ | ||
public class TextTemplatingHostContext | ||
{ | ||
ITextTemplatingAppDomainFactory appDomainFactory; | ||
ITextTemplatingAssemblyResolver assemblyResolver; | ||
ITextTemplatingVariables templatingVariables; | ||
IServiceProvider serviceProvider; | ||
|
||
public TextTemplatingHostContext(IProject project) | ||
: this( | ||
new TextTemplatingAppDomainFactory(), | ||
new TextTemplatingAssemblyResolver(project), | ||
new TextTemplatingVariables(), | ||
new TextTemplatingServiceProvider()) | ||
{ | ||
} | ||
|
||
public TextTemplatingHostContext( | ||
ITextTemplatingAppDomainFactory appDomainFactory, | ||
ITextTemplatingAssemblyResolver assemblyResolver, | ||
ITextTemplatingVariables templatingVariables, | ||
IServiceProvider serviceProvider) | ||
{ | ||
this.appDomainFactory = appDomainFactory; | ||
this.assemblyResolver = assemblyResolver; | ||
this.templatingVariables = templatingVariables; | ||
this.serviceProvider = serviceProvider; | ||
} | ||
|
||
public object GetService(Type serviceType) | ||
{ | ||
return serviceProvider.GetService(serviceType); | ||
} | ||
|
||
public string ExpandTemplateVariables(string name) | ||
{ | ||
return templatingVariables.ExpandVariables(name); | ||
} | ||
|
||
public ITextTemplatingAppDomain CreateTextTemplatingAppDomain(string applicationBase) | ||
{ | ||
return appDomainFactory.CreateTextTemplatingAppDomain(applicationBase); | ||
} | ||
|
||
public string ResolveAssemblyReference(string assemblyReference) | ||
{ | ||
return assemblyResolver.Resolve(assemblyReference); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters