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); }
private int RunCGIMode(string scriptFile) { var engine = new HostedScriptEngine { CustomConfig = ScriptFileHelper.CustomConfigPath(scriptFile) }; engine.AttachAssembly(Assembly.GetExecutingAssembly()); var request = new WebRequestContext(); engine.InjectGlobalProperty("ВебЗапрос", request, true); engine.InjectGlobalProperty("WebRequest", request, true); engine.InjectObject(this, false); ScriptFileHelper.OnBeforeScriptRead(engine); var source = engine.Loader.FromFile(scriptFile); Process process; try { process = engine.CreateProcess(this, source); } catch (Exception e) { ShowExceptionInfo(e); return(1); } var exitCode = process.Start(); if (!_isContentEchoed) { Echo(""); } return(exitCode); }