internal static void InitialiseScriptingEnvironment() { ScriptRuntimeSetup Setup = new ScriptRuntimeSetup(); Setup.LanguageSetups.Add(IronRuby.Ruby.CreateRubySetup()); Setup.LanguageSetups.Add(IronPython.Hosting.Python.CreateLanguageSetup(null)); RunTime = new ScriptRuntime(Setup); Engine = RunTime.GetEngine("py"); Scope = RunTime.CreateScope(); RunTime.IO.SetOutput(ShellOutStream, Encoding.UTF8); RunTime.IO.SetErrorOutput(ShellOutStream, Encoding.UTF8); Assembly MainAssembly = Assembly.GetExecutingAssembly(); string RootDir = Directory.GetParent(MainAssembly.Location).FullName; string HAGPath = Path.Combine(RootDir, "HtmlAgilityPack.dll"); Assembly HAGAssembly = Assembly.LoadFile(HAGPath); RunTime.LoadAssembly(MainAssembly); RunTime.LoadAssembly(HAGAssembly); RunTime.LoadAssembly(typeof(String).Assembly); RunTime.LoadAssembly(typeof(Uri).Assembly); RunTime.LoadAssembly(typeof(XmlDocument).Assembly); Engine.Runtime.TryGetEngine("py", out Engine); List <string> PySearchPaths = new List <string>(); foreach (string PyPath in PyPaths) { PySearchPaths.Add(PyPath.Replace("$ROOTDIR", RootDir)); } try { Engine.SetSearchPaths(PySearchPaths); } catch (Exception Exp) { IronException.Report("Unable to set PyPaths", Exp.Message, Exp.StackTrace); } foreach (string PyCommand in PyCommands) { try { ExecuteStartUpCommand(PyCommand); } catch (Exception Exp) { IronException.Report("Unable to execute Python startup command - " + PyCommand, Exp.Message, Exp.StackTrace); } } Engine.Runtime.TryGetEngine("rb", out Engine); List <string> RbSearchPaths = new List <string>(); foreach (string RbPath in RbPaths) { RbSearchPaths.Add(RbPath.Replace("$ROOTDIR", RootDir)); } Engine.SetSearchPaths(RbSearchPaths); foreach (string RbCommand in RbCommands) { try { ExecuteStartUpCommand(RbCommand); } catch (Exception Exp) { IronException.Report("Unable to execute Ruby startup command" + RbCommand, Exp.Message, Exp.StackTrace); } } Engine.Runtime.TryGetEngine("py", out Engine); ExecuteStartUpCommand("print 123"); ShellOutText = new StringBuilder(); IronUI.ResetInteractiveShellResult(); }