private bool CallJob(TriggerReader reader) { double jobNumber = 0; if (reader.PeekVariable()) { jobNumber = reader.ReadVariable().Value.AsDouble(); } else if (reader.PeekNumber()) { jobNumber = reader.ReadNumber(); } var args = reader.ReadValues().ToArray(); if (jobNumber > 0) { if (args == null || args.Length == 0) { reader.Page.Execute(100, jobNumber); } else { reader.Page.Execute(100, Enumerable.Concat(new object[] { jobNumber }, args).ToArray()); } } return(true); }
private bool JobCalled(TriggerReader reader) { double jobNumber = 0; if (reader.PeekVariable()) { jobNumber = reader.ReadVariable().Value.AsDouble(); } else if (reader.PeekNumber()) { jobNumber = reader.ReadNumber(); } double requiredJobNumber = reader.GetParameter <double>(0); if (reader.TryReadVariableTable(out VariableTable table, true)) { object[] args = reader.Parameters.Skip(1).ToArray(); for (int i = 0; i <= args.Length - 1; i++) { table.Add(i.ToString(), args[i]); } } bool result = false; if (jobNumber > 0 && jobNumber == requiredJobNumber) { result = reader.CurrentBlock.IndexOfTrigger(TriggerCategory.Effect, 115, reader.CurrentBlockIndex) == -1; } return(result); }
public double ReadVariableOrNumber(TriggerReader reader, bool addIfNotExist = false) { double num = 0; if (reader.PeekVariable()) { string str = reader.ReadVariable(addIfNotExist).Value.ToString(); double.TryParse(str, out num); } else if (reader.PeekNumber()) { num = reader.ReadNumber(); } return(num); }
private bool SetVariableToNumberOrVariable(TriggerReader reader) { var var = reader.ReadVariable(true); if (reader.PeekVariable <double>()) { var.Value = reader.ReadVariable().Value.AsDouble(0d); } else if (reader.PeekNumber()) { var.Value = reader.ReadNumber(); } return(true); }
public static bool CreateForm(TriggerReader reader) { string formName = (reader.PeekString()) ? reader.ReadString() : "Form"; if (reader.PeekVariable() == false) { return(false); } Variable var = reader.ReadVariable(true); Form form = new Form(); form.Text = formName; double id = ControlLib.CreateRandomID(); reader.Page.SetVariable(var.Name, id, var.IsConstant); form.Name = id.ToString(); ControlLib.controls.Add(id, form); form.ShowDialog(); form.Visible = true; return(true); }