Beispiel #1
0
 public void WriteInput(string data)
 {
     if (data.Length > 0 && data[0] == '\x01') // ^A
     {
         _escapeMode = !_escapeMode;
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"Printable ESC mode: {_escapeMode}\r\n"));
     }
     else if (data.Length > 0 && data[0] == '\x02') // ^B
     {
         _mouseMode = !_mouseMode;
         var decSet = _mouseMode ? "h" : "l";
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"\x1b[?1003{decSet}\x1b[?1006{decSet}"));
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"SGR Mouse mode (1003, 1006): {_mouseMode}\r\n"));
     }
     else if (data.Length > 0 && data[0] == '\x03') // ^C
     {
         _win32InputMode = !_win32InputMode;
         var decSet = _win32InputMode ? "h" : "l";
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"\x1b[?9001{decSet}"));
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"Win32 input mode: {_win32InputMode}\r\n"));
     }
     else
     {
         // Echo back to the terminal, but make backspace/newline work properly.
         var str = data.Replace("\r", "\r\n").Replace("\x7f", "\x08 \x08");
         if (_escapeMode)
         {
             str = str.Replace("\x1b", "\u241b");
         }
         TerminalOutput.Invoke(this, new TerminalOutputEventArgs(str));
     }
 }
        /// <summary>
        /// Writes the gioven scores to the configured outputs.
        /// </summary>
        /// <param name="results">A set of file matching scores</param>
        public void WriteOutput()
        {
            //TODO: must be selected by settings
            TerminalOutput t = new TerminalOutput(this.Settings);

            t.Write(this.MatchingResults);
        }
Beispiel #3
0
 private void AppendOutput(string message, Color textColor)
 {
     TerminalOutput.SelectionStart = TerminalOutput.Text.Length;
     TerminalOutput.SelectionColor = textColor;
     TerminalOutput.AppendText(message);
     TerminalOutput.ScrollToCaret();
 }
Beispiel #4
0
 public void AppendCommandLineToTerminalOutputResponse(string commandLine)
 {
     TerminalOutput.SelectionStart  = TerminalOutput.TextLength;
     TerminalOutput.SelectionLength = 0;
     commandLine = "# " + commandLine + "\n";
     TerminalOutput.SelectionColor = Color.Blue;
     TerminalOutput.AppendText(commandLine);
     TerminalOutput.SelectionColor = TerminalOutput.ForeColor;
     //this.TerminalOutput.Text = this.TerminalOutput.Text + "#" + commandLine+ "\n";
 }
        private void _terminalsManager_DisplayOutputRequested(object sender, TerminalOutput e)
        {
            var message = new ValueSet
            {
                [MessageKeys.Type]       = Constants.TerminalBufferRequestIdentifier,
                [MessageKeys.TerminalId] = e.TerminalId,
                [MessageKeys.Content]    = e.Data
            };

            _appServiceConnection.SendMessageAsync(message);
        }
Beispiel #6
0
        private void _terminalsManager_DisplayOutputRequested(object sender, TerminalOutput e)
        {
            var message = new ValueSet
            {
                [MessageKeys.Type]       = Constants.TerminalBufferRequestIdentifier,
                [MessageKeys.TerminalId] = e.TerminalId,
                [MessageKeys.Content]    = e.Data
            };

            // ReSharper disable once AssignmentIsFullyDiscarded
            _ = _appServiceConnection.SendMessageAsync(message);
        }
Beispiel #7
0
        public MainForm()
        {
            InitializeComponent();
            PnSendCommand.Enabled = false;

            Client = new TcpAppClient();
            Client.ConnectionStatusChanged += Client_ConnectionStatusChanged;
            Client.ResponseReceived        += Client_ResponseReceived;
            Client.CommandSend             += Client_CommandSend;

            TerminalOutput.Clear();
        }
Beispiel #8
0
 public void AppendCommandLineToTerminalOutput(string commandLine)
 {
     // this.TerminalOutput.Text = this.TerminalOutput.Text + ">" + commandLine + "\n"; ;
     TerminalOutput.SelectionStart  = TerminalOutput.TextLength;
     TerminalOutput.SelectionLength = 0;
     commandLine = "> " + commandLine + "\n";
     TerminalOutput.SelectionColor = Color.Red;
     TerminalOutput.AppendText(commandLine);
     TerminalOutput.SelectionColor = TerminalOutput.ForeColor;
     //String tekst = ">" + commandLine + "\n";
     //this.TerminalOutput.ForeColor = Color.Red;
 }
Beispiel #9
0
        public MainForm()
        {
            InitializeComponent();
            PnSendCommand.Enabled = false;

            AppClient = new TcpAppClient();
            AppClient.ConnectionStatusChanged += Client_ConnectionStatusChanged;
            AppClient.ResponseReceived        += Client_ResponseReceived;
            AppClient.CommandSend             += Client_CommandSend;

            TcpClient = new TcpClient();
            TcpClient.ConnectionStatusChanged += Client_ConnectionStatusChanged;
            TcpClient.DataReceived            += TcpClient_DataReceived;

            CbClientType.SelectedIndex = 0;
            TerminalOutput.Clear();
        }
Beispiel #10
0
        public void WriteInput(string data)
        {
            if (data.Length == 0)
            {
                return;
            }

            if (data[0] == '\x01') // ^A
            {
                _escapeMode = !_escapeMode;
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"Printable ESC mode: {_escapeMode}\r\n"));
            }
            else if (data[0] == '\x02') // ^B
            {
                _mouseMode = !_mouseMode;
                var decSet = _mouseMode ? "h" : "l";
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"\x1b[?1003{decSet}\x1b[?1006{decSet}"));
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"SGR Mouse mode (1003, 1006): {_mouseMode}\r\n"));
            }
            else if ((data[0] == '\x03') ||
                     (data == "\x1b[67;46;3;1;8;1_")) // ^C
            {
                _win32InputMode = !_win32InputMode;
                var decSet = _win32InputMode ? "h" : "l";
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"\x1b[?9001{decSet}"));
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"Win32 input mode: {_win32InputMode}\r\n"));

                // If escape mode isn't currently enabled, turn it on now.
                if (_win32InputMode && !_escapeMode)
                {
                    _escapeMode = true;
                    TerminalOutput.Invoke(this, new TerminalOutputEventArgs($"Printable ESC mode: {_escapeMode}\r\n"));
                }
            }
            else
            {
                // Echo back to the terminal, but make backspace/newline work properly.
                var str = data.Replace("\r", "\r\n").Replace("\x7f", "\x08 \x08");
                if (_escapeMode)
                {
                    str = str.Replace("\x1b", "\u241b");
                }
                TerminalOutput.Invoke(this, new TerminalOutputEventArgs(str));
            }
        }
Beispiel #11
0
 public void Start()
 {
     TerminalOutput.Invoke(this, new TerminalOutputEventArgs("ECHO CONNECTION\r\n^A: toggle printable ESC\r\n^B: toggle SGR mouse mode\r\n^C: toggle win32 input mode\r\n\r\n"));
     return;
 }
        /// <summary>
        /// Writes the gioven scores to the configured outputs.
        /// </summary>
        /// <param name="results">A set of file matching scores</param>
        public void WriteOutput()
        {
            TerminalOutput t = new TerminalOutput(this.Settings);

            t.Write(this.MatchingResults);//dfnbdfghjbdfhjgb
        }