private void validateScript(Controller c, Script s, Dictionary<string, Variable> vars, StringBuilder output) { // if script has never been validated, but has errors, then do not validate, they are parse errors. if (s.Valid == BlockBase.Validation.NeverRan && s.Log.ErrorCount > 0) { s.SetValid(false); // will set valid to failed. return; } s.SetValid(true); if (s.List) { vars.Clear(); s.ExecuteAsList(new Context(c, s, s, 0, vars), output); } else { c.Add(s); while (c.next(output)) { } } s.SetValid(false); }
/// <summary> Add script to controller, call next until false. </summary> /// <returns> false if valid is not passed </returns> private bool runThroughScript(Controller c, BlockBase s, StringBuilder sb) { if (s.Valid != BlockBase.Validation.Passed) return false; c.Add(s); bool AutoFill = c.AutoFill; c.AutoFill = false; while (c.next(sb)) { } c.AutoFill = AutoFill; return true; }