progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
64
AspClassic.Scripting/Hosting/Providers/HostingHelpers.cs
Normal file
64
AspClassic.Scripting/Hosting/Providers/HostingHelpers.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Runtime.Remoting;
|
||||
using AspClassic.Scripting.Runtime;
|
||||
using AspClassic.Scripting.Utils;
|
||||
|
||||
namespace AspClassic.Scripting.Hosting.Providers;
|
||||
|
||||
public static class HostingHelpers
|
||||
{
|
||||
public static ScriptDomainManager GetDomainManager(ScriptRuntime runtime)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(runtime, "runtime");
|
||||
return runtime.Manager;
|
||||
}
|
||||
|
||||
public static LanguageContext GetLanguageContext(ScriptEngine engine)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(engine, "engine");
|
||||
return engine.LanguageContext;
|
||||
}
|
||||
|
||||
public static SourceUnit GetSourceUnit(ScriptSource scriptSource)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(scriptSource, "scriptSource");
|
||||
return scriptSource.SourceUnit;
|
||||
}
|
||||
|
||||
public static ScriptCode GetScriptCode(CompiledCode compiledCode)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(compiledCode, "compiledCode");
|
||||
return compiledCode.ScriptCode;
|
||||
}
|
||||
|
||||
public static SharedIO GetSharedIO(ScriptIO io)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(io, "io");
|
||||
return io.SharedIO;
|
||||
}
|
||||
|
||||
public static Scope GetScope(ScriptScope scriptScope)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(scriptScope, "scriptScope");
|
||||
return scriptScope.Scope;
|
||||
}
|
||||
|
||||
public static ScriptScope CreateScriptScope(ScriptEngine engine, Scope scope)
|
||||
{
|
||||
ContractUtils.RequiresNotNull(engine, "engine");
|
||||
ContractUtils.RequiresNotNull(scope, "scope");
|
||||
ContractUtils.Requires(!RemotingServices.IsTransparentProxy(engine), "engine", "The engine cannot be a transparent proxy");
|
||||
return new ScriptScope(engine, scope);
|
||||
}
|
||||
|
||||
[Obsolete("You should implement a service via LanguageContext and call ScriptEngine.GetService")]
|
||||
public static TRet CallEngine<T, TRet>(ScriptEngine engine, Func<LanguageContext, T, TRet> f, T arg)
|
||||
{
|
||||
return engine.Call(f, arg);
|
||||
}
|
||||
|
||||
public static DocumentationOperations CreateDocumentationOperations(DocumentationProvider provider)
|
||||
{
|
||||
return new DocumentationOperations(provider);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue