コード例 #1
0
 private static void AddCursorKeys()
 {
     KeyMap.Add(0x25, Key.CursorLeft);
     KeyMap.Add(0x26, Key.CursorUp);
     KeyMap.Add(0x27, Key.CursorRight);
     KeyMap.Add(0x28, Key.CursorDown);
 }
コード例 #2
0
 private static void AddMathKeys()
 {
     KeyMap.Add(Key.Multiply, DInput.Key.NumberPadStar);
     KeyMap.Add(Key.Add, DInput.Key.NumberPadPlus);
     KeyMap.Add(Key.Subtract, DInput.Key.NumberPadMinus);
     KeyMap.Add(Key.Decimal, DInput.Key.NumberPadComma);
     KeyMap.Add(Key.Divide, DInput.Key.NumberPadSlash);
 }
コード例 #3
0
 /// <summary>
 /// No matching DInput key for Separator, Plus, Question,
 /// Tilde, ChatPadGreen, ChatPadOrange, Pipe, Quotes
 /// </summary>
 static KeyboardKeyMapper()
 {
     AddSpecialKeys();
     AddMathKeys();
     KeyMap.Add(Key.WindowsKey, DInput.Key.LeftWindowsKey);
     KeyMap.Add(Key.LeftWindows, DInput.Key.LeftWindowsKey);
     KeyMap.Add(Key.RightWindows, DInput.Key.RightWindowsKey);
 }
コード例 #4
0
 private static void AddSpecialKeys()
 {
     KeyMap.Add(Key.None, DInput.Key.Unknown);
     KeyMap.Add(Key.Enter, DInput.Key.Return);
     KeyMap.Add(Key.NumLock, DInput.Key.NumberLock);
     KeyMap.Add(Key.Scroll, DInput.Key.ScrollLock);
     KeyMap.Add(Key.OpenBrackets, DInput.Key.LeftBracket);
     KeyMap.Add(Key.CloseBrackets, DInput.Key.RightBracket);
 }
コード例 #5
0
        public void HoldKey(VirtualKeys key)
        {
            BotUtils.HoldKey(XMemory.Process.MainWindowHandle, new IntPtr((int)key));

            if (KeyMap.ContainsKey(key))
            {
                KeyMap[key] = false;
            }
            else
            {
                KeyMap.Add(key, false);
            }
        }
コード例 #6
0
 private static void AddNumPadKeys()
 {
     KeyMap.Add(0x60, Key.NumPad0);
     KeyMap.Add(0x61, Key.NumPad1);
     KeyMap.Add(0x62, Key.NumPad2);
     KeyMap.Add(0x63, Key.NumPad3);
     KeyMap.Add(0x64, Key.NumPad4);
     KeyMap.Add(0x65, Key.NumPad5);
     KeyMap.Add(0x66, Key.NumPad6);
     KeyMap.Add(0x67, Key.NumPad7);
     KeyMap.Add(0x68, Key.NumPad8);
     KeyMap.Add(0x69, Key.NumPad9);
 }
コード例 #7
0
 protected void RegisterShortcut(string command, Keys key)
 {
     // キーの重複を確認。コマンドは重複してもよい(異なるキーから同じコマンドを呼び出しても問題ない)
     if (KeyMap.ContainsKey(key))
     {
         throw new InvalidOperationException("The shortcut key has already been registered.");
     }
     KeyMap.Add(key, command);
     if (!CommandMap.ContainsKey(command))
     {
         CommandMap.Add(command, new HashSet <Keys>());
     }
     CommandMap[command].Add(key);
 }
コード例 #8
0
 /// <summary>
 /// No matching DInput key for Separator, Plus, Question,
 /// Tilde, ChatPadGreen, ChatPadOrange, Pipe, Quotes
 /// </summary>
 static KeyboardKeyMapper()
 {
     KeyMap.Add(Key.WindowsKey, DInput.Key.LeftWindowsKey);
     KeyMap.Add(Key.LeftWindows, DInput.Key.LeftWindowsKey);
     KeyMap.Add(Key.RightWindows, DInput.Key.RightWindowsKey);
     KeyMap.Add(Key.None, DInput.Key.Unknown);
     KeyMap.Add(Key.Enter, DInput.Key.Return);
     KeyMap.Add(Key.CapsLock, DInput.Key.Capital);
     KeyMap.Add(Key.PrintScreen, DInput.Key.PrintScreen);
     KeyMap.Add(Key.NumLock, DInput.Key.NumberLock);
     KeyMap.Add(Key.Scroll, DInput.Key.ScrollLock);
     KeyMap.Add(Key.OpenBrackets, DInput.Key.LeftBracket);
     KeyMap.Add(Key.CloseBrackets, DInput.Key.RightBracket);
 }
コード例 #9
0
 private static void AddLeftRightKeys()
 {
     KeyMap.Add(0x11, Key.LeftControl);
     KeyMap.Add(0xA2, Key.LeftControl);
     KeyMap.Add(0xA3, Key.RightControl);
     KeyMap.Add(0x10, Key.LeftShift);
     KeyMap.Add(0xA0, Key.LeftShift);
     KeyMap.Add(0xA1, Key.RightShift);
     KeyMap.Add(0x5B, Key.LeftWindows);
     KeyMap.Add(0x5C, Key.RightWindows);
     KeyMap.Add(0x12, Key.LeftAlt);
     KeyMap.Add(0xA4, Key.LeftAlt);
     KeyMap.Add(0xA5, Key.RightAlt);
 }
コード例 #10
0
        public CircleOf5ths()
        {
            this.list = (new CircularList <Key>()
            {
                new Key(NoteLetters.c),

                new Key(NoteLetters.g),
                new Key(NoteLetters.d),
                new Key(NoteLetters.a),
                new Key(NoteLetters.e),
                new Key(NoteLetters.b),

                new Key(NoteLetters.f, Accidental.s), new Key(NoteLetters.g, Accidental.f),

                new Key(NoteLetters.d, Accidental.f),
                new Key(NoteLetters.a, Accidental.f),
                new Key(NoteLetters.e, Accidental.f),
                new Key(NoteLetters.b, Accidental.f),
                new Key(NoteLetters.f),
            }).list;

            foreach (var key in this)
            {
                int flats = key.Where(n =>
                {
                    var a = Accidental.n;
                    key.GetSheetNoteName(n.Interval, out a);

                    return(a == Accidental.f);
                }).Count();
                int sharps = key.Where(n => {
                    var a = Accidental.n;
                    key.GetSheetNoteName(n.Interval, out a);

                    return(a == Accidental.s);
                }).Count();

                string keyStr = "0";
                if (flats > 0 && sharps == 0)
                {
                    keyStr = $"{flats}f";
                }
                else if (sharps > 0 && flats == 0)
                {
                    keyStr = $"{sharps}s";
                }
                key.KeyAccidentals = keyStr;
                KeyMap.Add(keyStr, key);
            }
        }
コード例 #11
0
 private static void AddFunctionKeys()
 {
     KeyMap.Add(0x70, Key.F1);
     KeyMap.Add(0x71, Key.F2);
     KeyMap.Add(0x72, Key.F3);
     KeyMap.Add(0x73, Key.F4);
     KeyMap.Add(0x74, Key.F5);
     KeyMap.Add(0x75, Key.F6);
     KeyMap.Add(0x76, Key.F7);
     KeyMap.Add(0x77, Key.F8);
     KeyMap.Add(0x78, Key.F9);
     KeyMap.Add(0x79, Key.F10);
     KeyMap.Add(0x7A, Key.F11);
     KeyMap.Add(0x7B, Key.F12);
 }
コード例 #12
0
 private static void AddMiscKeys()
 {
     KeyMap.Add(0x08, Key.Backspace);
     KeyMap.Add(0x09, Key.Tab);
     KeyMap.Add(0x0D, Key.Enter);
     KeyMap.Add(0x13, Key.Pause);
     KeyMap.Add(0x1B, Key.Escape);
     KeyMap.Add(0x20, Key.Space);
     KeyMap.Add(0x23, Key.End);
     KeyMap.Add(0x24, Key.Home);
     KeyMap.Add(0x2D, Key.Insert);
     KeyMap.Add(0x2E, Key.Delete);
     KeyMap.Add(0x6A, Key.Multiply);
     KeyMap.Add(0x6B, Key.Add);
     KeyMap.Add(0x6C, Key.Separator);
     KeyMap.Add(0x6D, Key.Subtract);
     KeyMap.Add(0x6E, Key.Decimal);
     KeyMap.Add(0x6F, Key.Divide);
     KeyMap.Add(0x90, Key.NumLock);
     KeyMap.Add(0x91, Key.Scroll);
     KeyMap.Add(0xBF, Key.Question);
     KeyMap.Add(0xC0, Key.Tilde);
 }