private void OnError_Event() { var err = _msc_compiler.Error; try { if (ExitException.Is(err)) { if (ExitException.ExitCode(err) == 0 || _error != null) { return; } } if (_error == null) { _error = new ScriptError(_script, _procedure, err.Description); } var line = err.Line; if (_script != null && line != 0 && line != _err_line) { _error.AddTrace(_script.GetTraceLineAt(line)); } _err_line = line; } finally { err.Clear(); } }
public bool Run(ScriptProcedure procedure, bool noevent = false) { Clean(); if (procedure == null) { return(true); } _procedure = procedure; try { procedure.Run(); } catch (Exception ex) { if (_error == null && !ExitException.Is(ex)) { throw; } } if (_error == null) { return(true); } if (OnError != null && !noevent) { OnError(_error); } return(false); }
public bool Eval(string code, out object result) { Clean(); try { result = _msc_compiler.Eval(code); return(true); } catch (Exception ex) { if (_error == null && !ExitException.Is(ex)) { throw; } _error.FillParentTrace(); result = null; return(false); } }
public bool Execute(string code, bool noevent = false) { Clean(); try { _msc_compiler.AddCode(code); } catch (Exception ex) { if (_error == null && !ExitException.Is(ex)) { throw; } } if (_error == null) { return(true); } _error.FillParentTrace(); if (OnError != null && !noevent) { OnError(_error); } return(false); }