/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/StandaloneRunner/StandaloneProcess.cs
49 строк
1 KB
Andrey Ovsiankin
Удалил неймспейс ScriptingEngine.Environment
15 июл 2021, 15:05
15 июл 2021, 15:05
6620f67
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using System.IO; using System.Reflection; using ScriptEngine.Machine; namespace StandaloneRunner { internal class StandaloneProcess { public string[] CommandLineArguments { get; set; } public int LoadAndRun(Stream codeStream) { var loader = new ProcessLoader(); var host = new StandaloneApplicationHost { CommandLineArguments = CommandLineArguments }; var process = loader.CreateProcess(codeStream, host); try { return process.Start(); } catch (ScriptInterruptionException e) { return e.ExitCode; } catch (Exception e) { host.ShowExceptionInfo(e); return 1; } } } internal class BinaryCodeSource : OneScript.Sources.ICodeSource { public string Location => Assembly.GetExecutingAssembly().Location; public string GetSourceCode() => "<Source is not available>"; } }