public void LoadScript(string FullNameOfScript, string PathToLibraries) { ScriptEngine RubyEngine = Ruby.CreateEngine(); if (PathToLibraries != null && PathToLibraries != string.Empty) { var paths = RubyEngine.GetSearchPaths(); paths.Add(PathToLibraries); RubyEngine.SetSearchPaths(paths); } try { RubyScript = RubyEngine.ExecuteFile(FullNameOfScript); } catch (Exception CurrentException) { throw new Exception(MyResources.Texts.ScriptExecuteError + "\r\n\r\n" + MyResources.Texts.Details + " " + CurrentException.Message); } try { LabObject = RubyScript.GetNewLab(); } catch (Exception CurrentException) { RubyScript = null; throw new Exception(MyResources.Texts.ExecuteMethodError + "\r\n\r\n" + MyResources.Texts.Details + " " + CurrentException.Message); } }
public void LoadScript(string FullNameOfScript, string PathToLibraries) { ScriptEngine PythonEngine = Python.CreateEngine(); //Добавляем путь для поиска импортируемых в Python скрипт модулей if (PathToLibraries != null && PathToLibraries != string.Empty) { var paths = PythonEngine.GetSearchPaths(); paths.Add(PathToLibraries); PythonEngine.SetSearchPaths(paths); } try { PythonScript = PythonEngine.ExecuteFile(FullNameOfScript); } catch (Exception CurrentException) { throw new Exception(MyResources.Texts.ScriptExecuteError + "\r\n\r\n" + MyResources.Texts.Details + " " + CurrentException.Message); } try { LabObject = PythonScript.GetNewLab(); } catch (Exception CurrentException) { PythonScript = null; throw new Exception(MyResources.Texts.ExecuteMethodError + "\r\n\r\n" + MyResources.Texts.Details + " " + CurrentException.Message); } }