public ActionProgramRun(ActionFile af, // associated file ActionProgram r, // the program ConditionVariables iparas, // input variables to the program only.. not globals ActionRun runner, // who is running it.. ActionCoreController ed) : base(r.Name) // allow a pause { actionfile = af; actionrun = runner; actioncontroller = ed; execlevel = 0; execstate[execlevel] = ExecState.On; nextstepnumber = 0; //System.Diagnostics.Debug.WriteLine("Run " + actionfile.name + "::" + r.Name); //ActionData.DumpVars(gvars, " Func Var:"); inputvars = iparas; // current vars is set up by ActionRun at the point of invokation to have the latests globals List <ActionBase> psteps = new List <ActionBase>(); ActionBase ac; for (int i = 0; (ac = r.GetStep(i)) != null; i++) { psteps.Add(ActionBase.CreateCopy(ac)); } programsteps = psteps; }
// now = true run immediately, else defer to current programs public void RunActions(bool now, List <ActionFileList.MatchingSets> ale, ActionRun run, Variables inputparas) { foreach (ActionFileList.MatchingSets ae in ale) // for every file which passed.. { foreach (Condition fe in ae.passed) // and every condition.. { Tuple <ActionFile, ActionProgram> ap = FindProgram(fe.action, ae.af); // find program using this name, prefer this action file first if (ap != null) // program got, { inputparas.Add(fe.actionvars); run.Run(now, ap.Item1, ap.Item2, inputparas); } } } }
// now = true run immediately, else defer to current programs public void RunActions(bool now, List <ActionFileList.MatchingSets> ale, ActionRun run, ConditionVariables inputparas) { foreach (ActionFileList.MatchingSets ae in ale) // for every file which passed.. { foreach (Condition fe in ae.passed) // and every condition.. { Tuple <ActionFile, ActionProgram> ap = FindProgram(fe.action, ae.af); // find program using this name, prefer this action file first if (ap != null) // program got, { ConditionVariables adparas = new ConditionVariables(); string flags; adparas.FromActionDataString(fe.actiondata, out flags); inputparas.Add(adparas); run.Run(now, ap.Item1, ap.Item2, inputparas); } } } }