/// <summary> /// This is fired anytime new data is received whether it is a newline or not. This will allow us to /// start putting that data into the window so the user can see it (even if the trigger can't fire until /// the full line is available). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleDataReceived(object sender, string e) { try { // Get a StringBuilder from the shared pool. var sb = Argus.Memory.StringBuilderPool.Take(); sb.Append(e); // Remove unwanted characters sb.RemoveUnsupportedCharacters(); // Append the data to the terminal as it comes in. GameTerminal.Append(sb); // If the back buffer setting is enabled put the data also in there. if (App.Settings.AvalonSettings.BackBufferEnabled) { GameBackBufferTerminal.Append(sb, false); } // Return the StringBuilder to the pool. Argus.Memory.StringBuilderPool.Return(sb); } catch (Exception ex) { GameTerminal.Append($"ERROR: {ex.Message}", AnsiColors.Red); } }
/// <summary> /// This is fired anytime new data is received whether it is a newline or not. This will allow us to /// start putting that data into the window so the user can see it (even if the trigger can't fire until /// the full line is available). Data provided here may or may not be a complete line. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleDataReceived(object sender, string e) { try { // Get a StringBuilder from the shared pool. var sb = Argus.Memory.StringBuilderPool.Take(); sb.Append(e); // Remove unwanted characters sb.RemoveUnsupportedCharacters(); // Nothing is there, perhaps because it was all replaced. Get out early. if (sb.Length == 0) { return; } // Append the data to the terminal as it comes in. GameTerminal.Append(sb); // If the back buffer setting is enabled put the data also in there. if (App.Settings.AvalonSettings.BackBufferEnabled) { GameBackBufferTerminal.Append(sb, false); } // Return the StringBuilder to the pool. Argus.Memory.StringBuilderPool.Return(sb); } catch (Exception ex) { this.Interp.Conveyor.EchoError($"ERROR (HandleDataReceived): {ex.Message}"); } }
/// <summary> /// Handles text from the interpreter that needs to be echo'd out to the terminal. This text /// does not get checked for triggers, it's an echo that's coming from the interpreter or /// the possibly the Conveyor. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InterpreterEcho(object sender, EventArgs e) { var ea = e as EchoEventArgs; AvalonTerminal term; if (ea == null) { GameTerminal.Append("--> Error: Null EchoEventArgs in InterpreterEcho", AnsiColors.Red); return; } switch (ea.Terminal) { case TerminalTarget.None: case TerminalTarget.Main: term = GameTerminal; break; case TerminalTarget.Communication: term = CommunicationTerminal; break; case TerminalTarget.OutOfCharacterCommunication: term = OocCommunicationTerminal; break; default: term = GameTerminal; break; } if (ea.UseDefaultColors) { term.Append(ea.Text); // If the back buffer setting is enabled put the data also in there. if (App.Settings.AvalonSettings.BackBufferEnabled && ea.Terminal == TerminalTarget.Main) { GameBackBufferTerminal.Append(ea.Text, false); } } else { term.Append(ea.Text, ea.ForegroundColor, ea.ReverseColors); // If the back buffer setting is enabled put the data also in there. if (App.Settings.AvalonSettings.BackBufferEnabled && ea.Terminal == TerminalTarget.Main) { GameBackBufferTerminal.Append(ea.Text, ea.ForegroundColor, ea.ReverseColors, false); } } }
/// <summary> /// This is fired anytime new data is received whether it is a newline or not. This will allow us to /// start putting that data into the window so the user can see it (even if the trigger can't fire until /// the full line is available). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleDataReceived(object sender, string e) { try { // Remove unwanted characters var sb = new StringBuilder(e); sb.RemoveUnsupportedCharacters(); // Append the data to the terminal as it comes in. GameTerminal.Append(sb.ToString()); } catch (Exception ex) { GameTerminal.Append($"ERROR: {ex.Message}", AnsiColors.Red); } }
/// <summary> /// Event for when the network button is clicked. /// </summary> /// <param name="o"></param> /// <param name="args"></param> private void NetworkButton_Click(object o, RoutedEventArgs args) { try { if (TabMain.IsConnected == false) { Connect(); } else { Disconnect(); } } catch (Exception ex) { GameTerminal.Append($"ERROR: {ex.Message}", AnsiColors.Red); } }
/// <summary> /// Handles text from the interpreter that needs to be echo'd out to the terminal. This text /// does not get checked for triggers, it's an echo that's coming from the interpreter or /// the possibly the Conveyor. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InterpreterEcho(object sender, EventArgs e) { var ea = e as EchoEventArgs; AvalonTerminal term; if (ea == null) { GameTerminal.Append("--> Error: Null EchoEventArgs in InterpreterEcho", AnsiColors.Red); return; } switch (ea.Terminal) { case TerminalTarget.None: case TerminalTarget.Main: term = GameTerminal; break; case TerminalTarget.Communication: term = CommunicationTerminal; break; case TerminalTarget.OutOfCharacterCommunication: term = OocCommunicationTerminal; break; default: term = GameTerminal; break; } if (ea.UseDefaultColors) { term.Append(ea.Text); } else { term.Append(ea.Text, ea.ForegroundColor, ea.ReverseColors); } }