Пример #1
0
        private OutputParser()
        {
            m_readers = new List <OutputCollectingReader>();
            vt        = new AnsiDecoder();
            client    = new AnsiDecoderClient();

            sb = new StringBuilder();

            vt.Subscribe(client);
            client.Characters += new libVT100.AnsiDecoderClient.CharactersDelegate(VT100CharactersReceived);
        }
Пример #2
0
        private void Load()
        {
            _screen           = new DynamicScreen((ClientSize.Width - _lineNumberWidth - (_border * 2)) / _charSize.Width);
            _screen.TabSpaces = 4;
            _vt100.Encoding   = Encoding.UTF8;
            _vt100.Subscribe(_screen);

            _vt100.Input(System.IO.File.ReadAllBytes(File));
            _screen.CursorPosition = new Point(0, 0);

            Text = $" - {File}  ({_screen.Width}x{_screen.Height})";

            Invalidate();
        }
Пример #3
0
        public void SetUp()
        {
            Reset();

            m_cursorPosition = new Point(0, 0);
            m_size           = new Size(10, 10);

            m_vt100 = new AnsiDecoder();

            m_chars  = new List <char[]>();
            m_output = new List <byte[]>();

            m_vt100.Subscribe(this);
            m_vt100.Output += new DecoderOutputDelegate(m_vt100_Output);
        }
Пример #4
0
        public void SetUp ()
        {
            Reset ();
            
            m_cursorPosition = new Point(0,0);
            m_size = new Size(10,10);
              
            m_vt100 = new AnsiDecoder ();
            
            m_chars = new List<char[]>();
            m_output = new List<byte[]>();

            m_vt100.Subscribe ( this );
            m_vt100.Output += new DecoderOutputDelegate(m_vt100_Output);
        }
Пример #5
0
        /*
         * 6.7.  Window Dimension Change Message
         *
         * When the window (terminal) size changes on the client side, it MAY
         * send a message to the other side to inform it of the new dimensions.
         *
         * byte      SSH_MSG_CHANNEL_REQUEST
         * uint32    recipient channel
         * string    "window-change"
         * boolean   FALSE
         * uint32    terminal width, columns
         * uint32    terminal height, rows
         * uint32    terminal width, pixels
         * uint32    terminal height, pixels
         */

        private void connectButton_Click(object sender, EventArgs e)
        {
            if (client != null && client.IsConnected)
            {
                return;
            }

            if (client != null)
            {
                client.Dispose();
            }

            host_textbox.Enabled         =
                user_textbox.Enabled     =
                    pass_textbox.Enabled = false;

            client = new SshClient(host_textbox.Text, user_textbox.Text, pass_textbox.Text)
            {
                KeepAliveInterval = new TimeSpan(0, 2, 0)
            };
            client.HostKeyReceived += Client_HostKeyReceived;
            client.ErrorOccurred   += Client_ErrorOccurred;

            keyboardStream = new KeyboardStream();
            var screenS = new ScreenStream();

            var tSize = terminalFrameBuffer.EstimateScreenSize();

            screen = new libVT100.TerminalFrameBuffer(tSize.X, tSize.Y);

            terminalFrameBuffer.BoundScreen = screen;
            terminalFrameBuffer.LegendLabel = terminalLegend;

            terminalFrameBuffer.Init();

            vt100            = new AnsiDecoder();
            vt100.Output    += Vt100_Output;
            screenS.InjectTo = vt100;
            vt100.Encoding   = new UTF8Encoding(); // Encoding.GetEncoding("utf8");
            vt100.Subscribe(screen);

            try
            {
                client.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Connect: " + ex.Message, "Connect Error", MessageBoxButtons.OK);
                client.Dispose();
                client = null;

                return;
            }

            checkLoginState();

            if (terminalFrameBuffer.CanFocus)
            {
                terminalFrameBuffer.Focus();
            }

            var termModes = new Dictionary <Renci.SshNet.Common.TerminalModes, uint>();

            var shell = client.CreateShell(keyboardStream, screenS, screenS,
                                           "VRTerm", (uint)tSize.X, (uint)tSize.Y, (uint)terminalFrameBuffer.Width, (uint)terminalFrameBuffer.Height, termModes);



            shell.Start();
        }