Пример #1
0
Файл: GUI.cs Проект: Corv/D3Bit
        public void OnKeyUp(object sender, KeyEventArgs e)
        {
            /*
            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.ScanKey))
            {
                if (_overlay == null || _overlay.IsDisposed)
                {
                    var procs = Process.GetProcessesByName("Diablo III");
                    if (procs.Length > 0)
                    {
                        Bitmap bitmap = Screenshot.GetSnapShot(procs[0]);
                        bitmap.Save("yy.png", ImageFormat.Png);
                        _overlay = new OverlayForm(bitmap);
                        _overlay.Show();
                    }
                }
                else
                {
                    _overlay.Close();
                    _overlay = null;
                    e.Handled = true;
                }
            }
            else if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.UploadKey) && _overlay != null && _overlay.Loaded && !_overlay.Uploading)
            {
                (new Thread(_overlay.Upload)).Start();
            }
            */
            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.ScanKey))
            {

                var procs = Process.GetProcessesByName("Diablo III");
                if (procs.Length > 0)
                {
                    Bitmap bitmap = Screenshot.GetSnapShot(procs[0]);
                    bitmap.Save("last_screen.png", ImageFormat.Png);
                    var c = new CardForm(bitmap);
                    c.Show();
                    c.BringToFront();
                }
            }
        }
Пример #2
0
        public void OnKeyUp(object sender, KeyEventArgs e)
        {
            /*
            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.ScanKey))
            {
                if (_overlay == null || _overlay.IsDisposed)
                {
                    var procs = Process.GetProcessesByName("Diablo III");
                    if (procs.Length > 0)
                    {
                        Bitmap bitmap = Screenshot.GetSnapShot(procs[0]);
                        bitmap.Save("yy.png", ImageFormat.Png);
                        _overlay = new OverlayForm(bitmap);
                        _overlay.Show();
                    }
                }
                else
                {
                    _overlay.Close();
                    _overlay = null;
                    e.Handled = true;
                }
            }
            else if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.UploadKey) && _overlay != null && _overlay.Loaded && !_overlay.Uploading)
            {
                (new Thread(_overlay.Upload)).Start();
            }
            */
            if (!Debugger.IsAttached) // do not process hot keys when not in game
            {
                int pid = Utils.WinAPI.GetForegroundProcessId();
                var proc = Process.GetProcessById(pid);
                if (proc.ProcessName != "Diablo III")
                {
                    return;
                }
            }

            if (e.KeyCode == (Keys)Enum.Parse(typeof(Keys), Properties.Settings.Default.ScanKey))
            {

                var procs = Process.GetProcessesByName("Diablo III");
                if (procs.Length > 0)
                {
                    Bitmap bitmap = Screenshot.GetSnapShot(procs[0]);
                    bitmap.Save("last_screen.png", ImageFormat.Png);
                    var c = new CardForm(bitmap);
                    c.Show();
                    c.BringToFront();
                }
            }
        }