示例#1
0
        public async Task UseSkill(Interceptor.Keys key)
        {
            Log.Message("UseSkill: " + key);

            System.Windows.Forms.Keys keyWF = System.Windows.Forms.Keys.X;

            if (key == Interceptor.Keys.F1)
            {
                keyWF = System.Windows.Forms.Keys.Z;
            }
            else if (key == Interceptor.Keys.F2)
            {
                keyWF = System.Windows.Forms.Keys.X;
            }

            memory.SendKey(keyWF);
            Console.WriteLine(keyWF);

            await Task.Delay(1);

            memory.SendClick(ProcessMemory.WMessages.WM_LBUTTONDOWN);
            await Task.Delay(1);

            memory.SendClick(ProcessMemory.WMessages.WM_LBUTTONUP);

            /*
             * input.SendKey(key, KeyState.Down);
             * await Task.Delay(1);
             * input.SendKey(key, KeyState.Up);
             *
             * input.SendMouseEvent(MouseState.LeftDown);
             * await Task.Delay(1);
             * input.SendMouseEvent(MouseState.LeftUp);
             */
        }
示例#2
0
        public void sendKey(Interceptor.Keys key)
        {
            input.SendKeys(Interceptor.Keys.Enter);
            return;

            Process p = MemoryHandler.getPokemonProcess();

            if (p != null)
            {
                SetForegroundWindow(p.MainWindowHandle);
            }
        }
示例#3
0
 internal void KPress(Interceptor.Keys vk, bool qwe = false)
 {
     if (Speed > 5 && !qwe)
     {
         _is.SendKey(vk, KeyState.Down); //_is.Keyboard.KeyDown(vk);
         ThSleep(Pkd - 5, Pkd + 5);
         _is.SendKey(vk, KeyState.Up);   //_is.Keyboard.KeyUp(vk);
         ThSleep(Pku - 5, Pku + 5);
     }
     else
     {
         _is.SendKey(vk);
     }
 }
示例#4
0
 public void SendKey(Interceptor.Keys k)
 {
     if (!input.IsLoaded)
     {
         LoadDriver();
     }
     if (input.IsLoaded)
     {
         input.SendKey(k, KeyState.Down);
         Thread.Sleep(kscdelay);
         input.SendKey(k, KeyState.Up);
         Thread.Sleep(kscdelay);
     }
 }
示例#5
0
        private void SendKey(Keys key, KeyState state)
        {
            try
            {
                Stroke    stroke    = new Stroke();
                KeyStroke keyStroke = new KeyStroke();

                keyStroke.Code  = key;
                keyStroke.State = state;

                stroke.Key = keyStroke;

                InterceptionDriver.Send(context, devk, ref stroke, 1);
            }
            catch { Stop(); }
        }
示例#6
0
        public void SendKeyboard(Interceptor.Keys key)
        {
            FocusEmulator();

            Input input = new Input();

            // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
            // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
            input.KeyboardFilterMode = KeyboardFilterMode.All;
            // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

            // Finally, load the driver
            input.Load();

            input.SendKeys(key);

            input.Unload();
        }
示例#7
0
        private void SendKeyPresses(List <int> commands)
        {
            List <int> newKeys = new List <int>();

            foreach (var singlecom in commands)
            {
                VirtualKeyCode newCmd = (VirtualKeyCode)singlecom;
                var            x      = Constants.InterceptorWrapper[newCmd];
                newKeys.Add(x);
            }


            List <Interceptor.Keys> keysDown = new List <Interceptor.Keys>(); //used if there is a ctrl, alt or shift

            foreach (var cmd in newKeys)
            {
                Interceptor.Keys newCmd = (Interceptor.Keys)cmd;
                //these are ctrl, alt and shift (left and right)
                if (newCmd == Interceptor.Keys.Control || newCmd == Interceptor.Keys.RightAlt || newCmd == Interceptor.Keys.RightAlt || newCmd == Interceptor.Keys.LeftShift || newCmd == Interceptor.Keys.RightShift)
                {
                    Console.WriteLine("[FORM] keydown = " + newCmd.ToString());
                    _input.ClickDelay = 20;
                    _input.SendKey(newCmd, KeyState.Down);

                    keysDown.Add(newCmd);
                }
                else
                {
                    Console.WriteLine("[FORM] keypress = " + newCmd.ToString());
                    _input.ClickDelay = 20;
                    _input.SendKeys(newCmd);
                }
            }

            if (keysDown.Count > 0)
            {
                foreach (var key in keysDown)
                {
                    Console.WriteLine("[FORM] Keyup = " + key.ToString());
                    _input.ClickDelay = 20;
                    _input.SendKey(key, KeyState.Up);
                }
            }
        }
示例#8
0
 /// <summary>
 /// 取消跟随
 /// </summary>
 /// <param name="key"></param>
 public void CancelFollowTeammateWithHotkey(Keys keyCode)
 {
     InputManager.ShareInstance().SendKey(keyCode, KeyState.Up);
     Thread.Sleep(new Random().Next(5, 20));
 }