public void PrepareToRun(Variables v, FunctionPersistentData fh, Dictionary <string, ExtendedControls.ConfigurableForm> d, bool chae = true) { currentvars = v; conditionpersistentdata = fh; closehandlesatend = chae; functions = new Functions(currentvars, conditionpersistentdata); // point the functions at our variables and our files.. dialogs = d; }
public ConditionEDDFunctions(Functions c, Variables v, FunctionPersistentData h, int recd) : base(c, v, h, recd) { if (functions == null) // one time init, done like this cause can't do it in {} { functions = new Dictionary <string, FuncEntry>(); functions.Add("systempath", new FuncEntry(SystemPath, FuncEntry.PT.LmeSE)); // literal functions.Add("version", new FuncEntry(Version, FuncEntry.PT.ImeSE)); functions.Add("star", new FuncEntry(Star, FuncEntry.PT.MESE, FuncEntry.PT.LmeSE)); functions.Add("ship", new FuncEntry(Ship, FuncEntry.PT.MESE)); functions.Add("events", new FuncEntry(Events, FuncEntry.PT.MESE, FuncEntry.PT.MESE)); } }
// now = true, run it immediately, else run at end of queue. Optionally pass in handles and dialogs in case its a sub prog public void Run(bool now, ActionFile fileset, ActionProgram r, Variables inputparas, FunctionPersistentData fh = null, Dictionary<string, ExtendedControls.ConfigurableForm> d = null, bool closeatend = true) { if (now) { if (progcurrent != null) // if running, push the current one back onto the queue to be picked up progqueue.Insert(0, progcurrent); progcurrent = new ActionProgramRun(fileset, r, inputparas, this, actioncontroller); // now we run this.. no need to push to stack progcurrent.PrepareToRun(new Variables(progcurrent.inputvariables, actioncontroller.Globals, fileset.filevariables), fh == null ? new FunctionPersistentData() : fh, d == null ? new Dictionary<string, ExtendedControls.ConfigurableForm>() : d, closeatend); // if no filehandles, make them and close at end } else { progqueue.Add(new ActionProgramRun(fileset, r, inputparas, this, actioncontroller)); } }
static public FunctionHandlers DefaultGetCFH(Functions c, Variables vars, FunctionPersistentData handles, int recdepth) { return(new ConditionEDDFunctions(c, vars, handles, recdepth)); }