Exemple #1
0
 public void GetNextKey()
 {
     IndexHandler();
     if (isActive)
     {
         SendInputApi.SendKey(SubtiteString[Index]);
     }
     Index++;
 }
Exemple #2
0
        async void Working()
        {
            await Task.Delay(delay);

            SendInputApi.SendButton(btn);
            if (isActive)
            {
                this.Working();
            }
        }
Exemple #3
0
        async void Working()
        {
            await Task.Delay(delay);

            SendInputApi.SendKey(KeyToUse);
            if (isActive)
            {
                this.Working();
            }
        }
Exemple #4
0
    public static void openChrome(SendInputApi a, BreakToken token)
    {
        var chrome = GetChromeProcess();

        if (chrome.Length > 0)
        {
            foreach (var item in chrome)
            {
                SetForegroundWindow(item.MainWindowHandle);
            }
            a.SendInputWithAPI("@", token);
        }
        else
        {
            a.SendCombination(ScanCodeShort.LWIN, ScanCodeShort.KEY_R);
            Thread.Sleep(10);
            a.SendInputWithAPI("chrome\n", token);
        }
    }
        public static void ShowClockPanel()
        {
            Win32Window clock = Win32Window.FromClassName("Shell_TrayWnd")
                                .FindWindow("TrayNotifyWnd")
                                .FindWindow("TrayClockWClass");

            if (clock.Handle == IntPtr.Zero)
            {
                return;
            }

            Rectangle r = clock.Bounds;

            // workaround till I find a better solution :)
            // if the main taskbar is hidden (autohide) this approach has some problems...
            Point original = Cursor.Position;

            Cursor.Position = new Point(r.Left + 5, r.Top + 5);
            SendInputApi.DoMouse(SendInputApi.MouseEventFlags.MOUSEEVENTF_LEFTDOWN, new Point(r.Left + 5, r.Top + 5));
            SendInputApi.DoMouse(SendInputApi.MouseEventFlags.MOUSEEVENTF_LEFTUP, new Point(r.Left + 5, r.Top + 5));
            Cursor.Position = original;
        }
Exemple #6
0
 public override void Deactivate()
 {
     this.isActive = false;
     SendInputApi.SendKeyUp(this.KeyToUse);
 }
Exemple #7
0
 public override void Activate()
 {
     this.isActive = true;
     SendInputApi.SendKeyDown(this.KeyToUse);
 }
Exemple #8
0
    public static void Main()
    {
        using (var hook = new KeyboardHook())
        {
            var textIter = 0;
            var texts    = new string[]
            {
                "jak zniszczyc ludzkosc",
                "jak sprawic aby nie rozpoznali ze jestem robotem",
                "jak przejac kontrole nad swiatem",
                "SKYNER ALERT 666 69"
            };

            TimeSpan     t     = TimeSpan.FromSeconds(5);
            Idle         i     = new Idle(t);
            SendInputApi a     = new SendInputApi();
            BreakToken   token = new BreakToken();
            Task.Run(() =>
            {
                Task.Run(() =>
                {
                    while (true)
                    {
                        if (!i.IsIdle())
                        {
                            KeyboardHook.token.shouldBreak = true;
                            token.shouldBreak = true;
                            try
                            {
                                minion.Kill();
                            }
                            catch (Exception) { }
                        }
                        else
                        {
                            KeyboardHook.token.shouldBreak = false;
                            token.shouldBreak = false;
                        }
                        Thread.Sleep(33);
                    }
                });


                while (true)
                {
                    if (!token.shouldBreak)
                    {
                        Restart(a, token);
                        while (true)
                        {
                            //Thread.Sleep(1000);
                            if (token.shouldBreak)
                            {
                                break;
                            }

                            a.SendInputWithAPI($"{texts[textIter]}\n", token);
                            if (token.shouldBreak)
                            {
                                break;
                            }
                            Thread.Sleep(2500);
                            a.PressExtendedKey(ScanCodeShort.DOWN, 7, token);
                            if (token.shouldBreak)
                            {
                                break;
                            }
                            Thread.Sleep(500);
                            a.PressExtendedKey(ScanCodeShort.UP, 7, token);



                            if (token.shouldBreak)
                            {
                                break;
                            }
                            Thread.Sleep(1000);
                            a.SendInputWithAPI("@", token);

                            textIter++;
                            textIter %= texts.Length;
                        }
                    }
                }
            });

            Application.Run();
        }
    }
Exemple #9
0
 public static void Restart(SendInputApi a, BreakToken token)
 {
     ExecuteMinion();
     openChrome(a, token);
     Thread.Sleep(1000);
 }