internal static InteractiveShellResult ExecuteMultiLineShellInput(string Commands) { List <string> CommandsList = new List <string>(); InteractiveShellResult ISR = new InteractiveShellResult(); try { string ProcessedCode = Commands; if (IronScripting.Engine.Setup.DisplayName.Contains("IronPython")) { string[] Results = PluginEditor.CheckPythonIndentation(ProcessedCode); if (Results[1].Length > 0) { ProcessedCode = PluginEditor.FixPythonIndentation(ProcessedCode); Results = PluginEditor.CheckPythonIndentation(ProcessedCode); if (Results[1].Length > 0) { throw new Exception(Results[1]); } } } ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(ProcessedCode, SourceCodeKind.AutoDetect); Source.Execute(IronScripting.Scope); Reset(); return(ISR); } catch (Exception exp) { ISR.ResultString = "Exception : " + exp.Message + Environment.NewLine; Reset(); return(ISR); } }
static void Executor() { while (On) { try { On = false; if (QueuedCommands.Length > 0) { InteractiveShellResult Result = IronScripting.ExecuteMultiLineShellInput(QueuedCommands); IronUI.UpdateInteractiveShellResult(Result); } else { InteractiveShellResult Result = IronScripting.ExecuteInteractiveShellInput(QueuedCommand); IronUI.UpdateInteractiveShellResult(Result); } } catch (ThreadAbortException) { } catch (Exception exp) { IronException.Report("Error executing Scripting Shell commands", exp.Message, exp.StackTrace); } MSR.Reset(); MSR.WaitOne(); } }
internal static InteractiveShellResult ExecuteMultiLineShellInput(string Commands) { List <string> CommandsList = new List <string>(); InteractiveShellResult ISR = new InteractiveShellResult(); try { ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(Commands, SourceCodeKind.AutoDetect); Source.Execute(IronScripting.Scope); Reset(); return(ISR); } catch (Exception exp) { ISR.ResultString = "Exception : " + exp.Message + Environment.NewLine; Reset(); return(ISR); } }
internal static InteractiveShellResult ExecuteInteractiveShellInput(string Command) { InteractiveShellResult ISR = new InteractiveShellResult(); if (MoreExpected) { CommandBuffer += Command; } else { CommandBuffer = Command; } try { ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(CommandBuffer, SourceCodeKind.InteractiveCode); ScriptCodeParseResult Result = Source.GetCodeProperties(); if (Result == ScriptCodeParseResult.Complete || Result == ScriptCodeParseResult.Invalid || CanExecute(Command)) { Source.Execute(IronScripting.Scope); Reset(); return(ISR); } else { ISR.MoreExpected = true; Set(Command); return(ISR); } } catch (Exception exp) { ISR.ResultString = "Exception: " + exp.Message + Environment.NewLine; Reset(); return(ISR); } }
internal static InteractiveShellResult ExecuteMultiLineShellInput(string Commands) { List<string> CommandsList = new List<string>(); InteractiveShellResult ISR = new InteractiveShellResult(); try { ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(Commands, SourceCodeKind.AutoDetect); Source.Execute(IronScripting.Scope); Reset(); return ISR; } catch (Exception exp) { ISR.ResultString = "Exception : " + exp.Message + Environment.NewLine; Reset(); return ISR; } }
internal static InteractiveShellResult ExecuteInteractiveShellInput(string Command) { InteractiveShellResult ISR = new InteractiveShellResult(); if (MoreExpected) { CommandBuffer += Command; } else { CommandBuffer = Command; } try { ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(CommandBuffer, SourceCodeKind.InteractiveCode); ScriptCodeParseResult Result = Source.GetCodeProperties(); if (Result == ScriptCodeParseResult.Complete || Result == ScriptCodeParseResult.Invalid || CanExecute(Command)) { Source.Execute(IronScripting.Scope); Reset(); return ISR; } else { ISR.MoreExpected = true; Set(Command); return ISR; } } catch (Exception exp) { ISR.ResultString = "Exception: " + exp.Message + Environment.NewLine; Reset(); return ISR; } }
internal static void UpdateInteractiveShellResult(InteractiveShellResult ISR) { if (UI.InteractiveShellOut.InvokeRequired) { UpdateInteractiveShellResult_d UISR_d = new UpdateInteractiveShellResult_d(UpdateInteractiveShellResult); UI.Invoke(UISR_d, new object[] { ISR }); } else { if (ISR.MoreExpected) { UpdateInteractiveShellOut(IronScripting.ShellPrompt); } else if(ISR.ResultString.Length > 0) { UpdateInteractiveShellOut(ISR.ResultString); } UpdateShellInPrompt(IronScripting.ShellPrompt); ActivateinteractiveShellUI(); } }
internal static InteractiveShellResult ExecuteMultiLineShellInput(string Commands) { List<string> CommandsList = new List<string>(); InteractiveShellResult ISR = new InteractiveShellResult(); try { if (IronScripting.Engine.Setup.DisplayName.Contains("IronPython")) { string[] Results = PluginEditor.CheckPythonIndentation(Commands); if (Results[1].Length > 0) { throw new Exception(Results[1]); } } ScriptSource Source = IronScripting.Engine.CreateScriptSourceFromString(Commands, SourceCodeKind.AutoDetect); Source.Execute(IronScripting.Scope); Reset(); return ISR; } catch (Exception exp) { ISR.ResultString = "Exception : " + exp.Message + Environment.NewLine; Reset(); return ISR; } }