/// <summary> /// Handles the OnProcessOutput event of the processInterface control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ConsoleStreamEventArgs"/> instance containing the event data.</param> void ProcessInterface_OnProcessOutput(object sender, ConsoleStreamEventArgs args) { string output = args.Content; /*if (!output.EndsWith("\n")) * { * output += "\n"; * }*/ output += "\n"; Color defaultColor = Color.White; if (args.Content.Contains("[")) { output = WriteFormattedOutput(output, defaultColor); } else { // Write the output, in white WriteOutput(output, defaultColor); } // Fire the output event. FireConsoleOutputEvent(output); }
/// <summary> /// Handles the OnPromptChanged event of the consoleStream interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ConsoleStreamEventArgs"/> instance containing the event data.</param> private void ProcessInterface_OnPromptChange(object sender, ConsoleStreamEventArgs args) { if (this.InvokeRequired) { Invoke((Action)(() => { Prompt = args.Content; })); } else { Prompt = args.Content; } }
/// <summary> /// Handles the OnProcessExit event of the processInterface control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ConsoleStreamEventArgs"/> instance containing the event data.</param> void ProcessInterface_OnProcessExit(object sender, ConsoleStreamEventArgs args) { // Are we showing diagnostics? if (ShowDiagnostics) { WriteOutput(Environment.NewLine + processInterface.ProcessFileName + " exited.", Color.FromArgb(255, 0, 255, 0)); } // Read only again. Invoke((Action)(() => { richTextBoxConsole.ReadOnly = false; })); }
/// <summary> /// Handles the OnProcessError event of the processInterface control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ConsoleStreamEventArgs"/> instance containing the event data.</param> void ProcessInterface_OnProcessError(object sender, ConsoleStreamEventArgs args) { string output = args.Content; if (!output.EndsWith("\n")) { output += "\n"; } // Write the output, in red WriteOutput(output, Color.Red); // Fire the output event. FireConsoleOutputEvent(output); }
/// <summary> /// Handles the OnCommandExecute event of the processInterface control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ConsoleStreamEventArgs"/> instance containing the event data.</param> void ProcessInterface_OnProcessCommand(object sender, ConsoleStreamEventArgs args) { //nothing to do here }
private void ConsoleStreamOnOnProcessInput(object sender, ConsoleStreamEventArgs args) { txtStreamInput.Text += $"\n{args.Content}"; }