private int RunCGIMode(string scriptFile) { var engine = new HostedScriptEngine(); engine.AttachAssembly(System.Reflection.Assembly.GetExecutingAssembly()); var request = new WebRequestContext(); engine.InjectGlobalProperty("ВебЗапрос", request, true); engine.InjectObject(this, false); engine.Initialize(); var source = engine.Loader.FromFile(scriptFile); Process process; try { process = engine.CreateProcess(this, source); } catch (Exception e) { ShowExceptionInfo(e); return 1; } int exitCode = process.Start(); if (!_isContentEchoed) Echo(""); return exitCode; }
public static HostedScriptEngine StartEngine() { var engine = new ScriptEngine.HostedScript.HostedScriptEngine(); engine.Initialize(); engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(oscriptFtp.FtpConnection))); return(engine); }
public static HostedScriptEngine StartEngine() { var engine = new ScriptEngine.HostedScript.HostedScriptEngine(); engine.Initialize(); engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(v8unpack.File8Reader))); return(engine); }
public static HostedScriptEngine StartEngine() { var engine = new ScriptEngine.HostedScript.HostedScriptEngine(); engine.Initialize(); // Тут можно указать любой класс из компоненты engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(OneScript.InternetMail.InternetMail))); return(engine); }
public static HostedScriptEngine StartEngine() { var engine = new ScriptEngine.HostedScript.HostedScriptEngine(); engine.Initialize(); // Тут можно указать любой класс из компоненты engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(oscriptcomponent.MyClass))); // Если проектов компонент несколько, то надо взять по классу из каждой из них // engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(oscriptcomponent_2.MyClass_2))); // engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(oscriptcomponent_3.MyClass_3))); return(engine); }
static void Main(string[] args) { var engine = new ScriptEngine.HostedScript.HostedScriptEngine(); engine.Initialize(); // Тут можно указать любой класс из компоненты engine.AttachAssembly(System.Reflection.Assembly.GetAssembly(typeof(onescript_extensions.AssemblyReflector.AssemblyReflector))); var MyRef = new onescript_extensions.AssemblyReflector.AssemblyReflector(); MyRef.LoadAssembly(ScriptEngine.Machine.ValueFactory.Create(@"c:\work\portable\OneScript\lib\extensions\bin\onescript-extensions.dll")); var newdata = MyRef.GetAsmTypes(); onescript_extensions.AssemblyReflector.AssemblyType curT = (onescript_extensions.AssemblyReflector.AssemblyType)newdata.Get(0); var PPP = curT.GetProperties(); Console.WriteLine(newdata); }