/// <summary> /// Run the script once /// </summary> /// <param name="script_text"></param> public void RunOnce(string script_text, bool blocking = true) { RunThread(delegate() { DateTime start_time = DynamicTimerStart = DateTime.Now; List <FunctionCall> base_script = ProcessScript(script_text); ExecuteScript(base_script); }); if (blocking) { ScriptThread.Join(); } }
/// <summary> /// Start running the script in a loop. /// /// </summary> /// <param name="script_text"></param> public void RunLoop(string script_text, bool blocking = true) { RunThread(delegate() { DateTime start_time = DynamicTimerStart = DateTime.Now; int loop_count = 0; List <FunctionCall> base_script = ProcessScript(script_text); while (true) { ExecuteScript(base_script); loop_count++; OnLoopFinished(new LoopFinishedEventArgs(loop_count, DateTime.Now - start_time)); } }); if (blocking) { ScriptThread.Join(); } }