private List <string> RunScript(CDS.CSharpScripting.CompiledScript compiledScript) { List <string> result = null; runtimeOutput.CDSWriteLine("* Running script *"); using (var console = new CDS.CSharpScripting.ConsoleOutputHook(msg => runtimeOutput.CDSWrite(msg))) { try { result = CDS.CSharpScripting.ScriptRunner.Run <List <string> >( compiledScript: compiledScript, globals: null); } catch (Exception exception) { Common.SendExceptionToOutput( runtimeOutput, "Exception caught while running the script", exception); } } runtimeOutput.CDSWriteLine("* Script run complete *"); return(result); }
private async Task <object> RunScript() { object result = null; output.CDSWriteLine("* Running script *"); using (var console = new CDS.CSharpScripting.ConsoleOutputHook(msg => output.CDSWrite(msg))) { try { isScriptRunning = true; scriptGlobals.shouldQuit = false; csharpEditor.Cursor = Cursors.WaitCursor; csharpEditor.Enabled = false; result = await CDS.CSharpScripting.ScriptRunner.AsyncRun <object>(compiledScript : compiledScript, scriptGlobals); csharpEditor.Enabled = true; csharpEditor.Cursor = Cursors.Default; isScriptRunning = false; output.CDSWriteLine($"* Script run is complete *"); } catch (Exception exception) { Common.SendExceptionToOutput( output, "Exception caught while running the script", exception); } } return(result); }
private void RunScript() { output.CDSWriteLine("* Running script *"); using (var console = new CDS.CSharpScripting.ConsoleOutputHook(msg => output.CDSWrite(msg))) { try { CDS.CSharpScripting.ScriptRunner.Run(compiledScript: compiledScript); output.CDSWriteLine($"* Script run is complete *"); } catch (Exception exception) { Common.SendExceptionToOutput( output, "Exception caught while running the script", exception); } } }
private void RunScript(CDS.CSharpScripting.CompiledScript compiledScript) { runtimeOutput.CDSWriteLine("* Running script *"); using (var console = new CDS.CSharpScripting.ConsoleOutputHook(msg => runtimeOutput.CDSWrite(msg))) { try { CDS.CSharpScripting.ScriptRunner.Run( compiledScript: compiledScript, globals: globals); runtimeOutput.CDSWriteLine($"* Script run is complete: the new value of Animal is [{globals.Animal}] *"); } catch (Exception exception) { Common.SendExceptionToOutput( runtimeOutput, "Exception caught while running the script", exception); } } }