Exemplo n.º 1
0
        protected KeyData DecodeSequence7Bit(Stream inputStream)
        {
            var keyData = new KeyData(0, true);

            // Read control character.
            var controlChar = (byte)inputStream.ReadByte();

            switch ((char)controlChar)
            {
            case '[':     // CSI
                keyData.Value = DecodeControlSequence(inputStream);
                break;

            default:
                XtermHelper.ThrowUnrecognisedCharException("Unrecognised 7-bit control character",
                                                           controlChar);
                break;
            }

            return(keyData);
        }
Exemplo n.º 2
0
        protected byte DecodeControlSequence(Stream inputStream)
        {
            var controlChar = (byte)inputStream.ReadByte();

            switch ((char)controlChar)
            {
            case 'A':
                return((byte)Keys.Up);

            case 'B':
                return((byte)Keys.Down);

            case 'C':
                return((byte)Keys.Right);

            case 'D':
                return((byte)Keys.Left);
            }

            XtermHelper.ThrowUnrecognisedCharException("Unrecognised char in control sequence",
                                                       controlChar);
            return(0);
        }