public void DeleteVar(string v) { currentvars.Delete(v); }
public void DeleteVariable(string name) { programrunglobalvariables.Delete(name); persistentglobalvariables.Delete(name); globalvariables.Delete(name); }
//special call for execute, needs to pass back more data public bool ExecuteCallAction(ActionProgramRun ap, out string progname, out ConditionVariables vars) { Dictionary <string, string> altops; if (FromString(UserData, out progname, out vars, out altops) && progname.Length > 0) { List <string> wildcards = new List <string>(); ConditionVariables newitems = new ConditionVariables(); foreach (string key in vars.NameEnumuerable) { int asterisk = key.IndexOf('*'); if (asterisk >= 0) // SEE if any wildcards, if so, add to newitems { bool noexpand = altops[key].Contains("$"); // wildcard operator determines expansion state wildcards.Add(key); string prefix = key.Substring(0, asterisk); foreach (string jkey in ap.variables.NameEnumuerable) { if (jkey.StartsWith(prefix)) { if (noexpand) { newitems[jkey] = ap[jkey]; } else { string res; if (ap.functions.ExpandString(ap[jkey], out res) == ConditionFunctions.ExpandResult.Failed) { ap.ReportError(res); return(false); } newitems[jkey] = res; } } } } } foreach (string w in wildcards) // remove wildcards { vars.Delete(w); } //foreach ( stKeyValuePair<string,string> k in vars.values) // for the rest, before we add in wildcards, expand foreach (string k in vars.NameEnumuerable.ToList()) // for the rest, before we add in wildcards, expand. Note ToList { bool noexpand = altops[k].Contains("$"); // when required if (!noexpand) { string res; if (ap.functions.ExpandString(vars[k], out res) == ConditionFunctions.ExpandResult.Failed) { ap.ReportError(res); return(false); } vars[k] = res; } } vars.Add(newitems); // finally assemble the variables return(true); } else { ap.ReportError("Call not configured"); return(false); } }