protected override void OnPlaying(TimeSpan startTime, TimeSpan endTime) { base.OnPlaying(startTime, endTime); ScriptHostGenerator hostGenerator = new ScriptHostGenerator(); _scriptHost = hostGenerator.GenerateScript(this.Sequence as ScriptSequence); string[] errors = hostGenerator.Errors.ToArray(); OnMessage(new ExecutorMessageEventArgs(Sequence, string.Join(Environment.NewLine, errors))); // An end time < start time means compile only. if (endTime >= startTime) { if (errors.Length == 0) { // Under the current implementation, this results in a thread being spawned. // That thread is the actual execution path of their code. _scriptHost.Ended += (sender, e) => { EndTime = TimeSpan.Zero; }; _scriptHost.Error += (sender, e) => { OnError(e); }; _scriptHost.Start(); } else { throw new Exception("Script did not compile."); } } }
protected override void OnPlaying(TimeSpan startTime, TimeSpan endTime) { base.OnPlaying(startTime, endTime); ScriptHostGenerator hostGenerator = new ScriptHostGenerator(); _scriptHost = hostGenerator.GenerateScript(this.Sequence as ScriptSequence); string[] errors = hostGenerator.Errors.ToArray(); OnMessage(new ExecutorMessageEventArgs(Sequence, string.Join(Environment.NewLine, errors))); // An end time < start time means compile only. if(endTime >= startTime) { if(errors.Length == 0) { // Under the current implementation, this results in a thread being spawned. // That thread is the actual execution path of their code. _scriptHost.Ended += (sender, e) => { EndTime = TimeSpan.Zero; }; _scriptHost.Error += (sender, e) => { OnError(e); }; _scriptHost.Start(); } else { throw new Exception("Script did not compile."); } } }
private void _StartScript() { if (_scriptHost != null) { _scriptHost.Sequence = Sequence; _scriptHost.TimingSource = TimingSource; _scriptHost.Ended += _ScriptEnded; _scriptHost.Error += _ScriptError; _scriptHost.Start(); } }