Example #1
0
        public void SingleChar2()
        {
            KeyFunction           f  = KeyFunction.Parse("Ctrl+6=0x1F");
            FixedStyleKeyFunction fs = f.ToFixedStyle();

            Assert.AreEqual(1, fs._keys.Length);
            Assert.AreEqual(1, fs._datas.Length);
            Assert.AreEqual(Keys.Control | Keys.D6, fs._keys[0]);
            Assert.AreEqual(1, fs._datas[0].Length);
            Assert.AreEqual(31, (int)fs._datas[0][0]);
        }
Example #2
0
        public void SingleChar1()
        {
            KeyFunction           f  = KeyFunction.Parse("C=0x03");
            FixedStyleKeyFunction fs = f.ToFixedStyle();

            Assert.AreEqual(1, fs._keys.Length);
            Assert.AreEqual(1, fs._datas.Length);
            Assert.AreEqual(Keys.C, fs._keys[0]);
            Assert.AreEqual(1, fs._datas[0].Length);
            Assert.AreEqual(3, (int)fs._datas[0][0]);
        }
Example #3
0
        public void String2()
        {
            KeyFunction           f  = KeyFunction.Parse("Ctrl+Shift+L=ls -la");
            FixedStyleKeyFunction fs = f.ToFixedStyle();

            Assert.AreEqual(1, fs._keys.Length);
            Assert.AreEqual(1, fs._datas.Length);
            Assert.AreEqual(Keys.Control | Keys.Shift | Keys.L, fs._keys[0]);
            Assert.AreEqual("ls -la", fs._datas[0]);

            Assert.AreEqual("Ctrl+Shift+L=ls -la", f.Format());
        }
Example #4
0
        public void Multi1()
        {
            KeyFunction           f  = KeyFunction.Parse("Ctrl+Shift+L=ls -la, Ctrl+Shift+F=find -name");
            FixedStyleKeyFunction fs = f.ToFixedStyle();

            Assert.AreEqual(2, fs._keys.Length);
            Assert.AreEqual(2, fs._datas.Length);
            Assert.AreEqual(Keys.Control | Keys.Shift | Keys.L, fs._keys[0]);
            Assert.AreEqual(Keys.Control | Keys.Shift | Keys.F, fs._keys[1]);
            Assert.AreEqual("ls -la", fs._datas[0]);
            Assert.AreEqual("find -name", fs._datas[1]);

            Assert.AreEqual("Ctrl+Shift+L=ls -la, Ctrl+Shift+F=find -name", f.Format());
        }
Example #5
0
        public void String1()
        {
            KeyFunction           f  = KeyFunction.Parse("Ctrl+Question=0x010x020x1F0x7F");
            FixedStyleKeyFunction fs = f.ToFixedStyle();

            Assert.AreEqual(1, fs._keys.Length);
            Assert.AreEqual(1, fs._datas.Length);
            Assert.AreEqual(Keys.Control | Keys.OemQuestion, fs._keys[0]);
            Assert.AreEqual(4, fs._datas[0].Length);
            Assert.AreEqual(2, (int)fs._datas[0][1]);
            Assert.AreEqual(127, (int)fs._datas[0][3]);

            Assert.AreEqual("Ctrl+OemQuestion=0x010x020x1F0x7F", f.Format());
        }
Example #6
0
        public void Reset(ITerminalEmulatorOptions opt)
        {
            //TODO ここはPeripheralPanelとかぶっている。なんとかしたい
            StringBuilder bld = new StringBuilder();

            if (opt.Send0x7FByDel)
            {
                bld.Append("Delete=0x7F");
            }
            if (opt.Send0x7FByBack)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = opt.Zone0x1F;

            if (ks != KeyboardStyle.None)
            {
                string s;
                if (ks == KeyboardStyle.Default)
                {
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                }
                else //Japanese
                {
                    s = "Ctrl+BackSlash=0x1F";
                }
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(s);
            }

            if (opt.CustomKeySettings.Length > 0)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(opt.CustomKeySettings);
            }

            //仕上げ。パースエラーがちょっとアレだ
            _keyFunction = KeyFunction.Parse(bld.ToString()).ToFixedStyle();
        }