static void EvaluateScript(string filename) { filename = Program.ParseSpherePath(filename, "scripts"); string text = File.ReadAllText(filename, ISO_8859_1); StringScriptSource source = new StringScriptSource(text, filename); RunCode(source); }
static void EvaluateSystemScript(string filename) { filename = GlobalProps.EnginePath + "/system/scripts/" + filename; string text = File.ReadAllText(filename, ISO_8859_1); StringScriptSource source = new StringScriptSource(text, filename); RunCode(source); }
public static void RunCode(StringScriptSource source) { try { Program._engine.Execute(source); } catch (JavaScriptException ex) { Program.ShowAbortScreen(String.Format("Script error in \'{0}\', line: {1}\n{2}", ex.SourcePath, ex.LineNumber, ex.Message)); } catch (Exception e) { var st = new StackTrace(e, true); Console.WriteLine(st.ToString()); Program.ShowAbortScreen(String.Format("Fatal Error: {0}", e.Message)); } }