Ejemplo n.º 1
0
        private static void LoadKeyCodes()
        {
            System.Collections.Specialized.StringCollection saved = Properties.Settings.Default.Keybind;
            VirtualKeyCode[] savedKeybinds = new VirtualKeyCode[saved.Count];

            for (int i = 0; i < saved.Count; i++)
            {
                savedKeybinds[i] = Keybinds.KeyCodeLookup(saved[i]);
            }

            muteKeyCodes = savedKeybinds;
        }
Ejemplo n.º 2
0
        private void HandleKeybind()
        {
            keys.Reverse();

            Keys[] keyArr = new Keys[keys.Count];
            int    indx   = 0;

            foreach (Keys k in keys)
            {
                keyArr[indx] = k;
                indx++;
            }

            string textBoxText = "";

            string[]         keybindStrings  = new string[keys.Count];
            VirtualKeyCode[] virtualKeyCodes = new VirtualKeyCode[keys.Count];
            Properties.Settings.Default.Keybind.Clear();
            for (int i = 0; i < keyArr.Length; i++)
            {
                VirtualKeyCode vKeyCode = Keybinds.GetVirtualKeyCode(keyArr[i]);
                virtualKeyCodes[i] = vKeyCode;

                string keybindAsString = Keybinds.GetKeyCodeString(vKeyCode);
                textBoxText      += keybindAsString;
                keybindStrings[i] = keybindAsString;
                Properties.Settings.Default.Keybind.Add(keybindAsString);

                if (i < keyArr.Length - 1)
                {
                    textBoxText += " + ";
                }
            }

            Properties.Settings.Default.Save();
            Program.muteKeyCodes = virtualKeyCodes;
            textBox1.ForeColor   = Color.FromArgb(255, 255, 243);
            textBox1.BackColor   = Color.FromArgb(48, 51, 57);
            textBox1.Text        = textBoxText;


            keys.Clear();
            ActiveControl = background;
        }