Пример #1
0
        public void OnMouseAction(MouseButton key)
        {
            if (Settings.ActivationMouseButton != MouseButton.Left && key == Settings.ActivationMouseButton)
            { //check if user pressed activation key
                if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog())
                    {
                        openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                        openFileDialog.Filter           = "image files (*.png)|*.png|All files (*.*)|*.*";
                        openFileDialog.FilterIndex      = 2;
                        openFileDialog.RestoreDirectory = true;
                        openFileDialog.Multiselect      = true;

                        if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            Task.Factory.StartNew(() =>
                            {
                                try
                                {
                                    foreach (string file in openFileDialog.FileNames)
                                    {
                                        Main.AddLog("Testing fullscreen file: " + file.ToString());

                                        Bitmap image = new Bitmap(file);
                                        OCR.ProcessSnapIt(image, image, new Point(0, 0));
                                    }
                                }
                                catch (Exception e)
                                {
                                    AddLog(e.Message);
                                    StatusUpdate("Failed to load image", 1);
                                }
                            });
                        }
                        else
                        {
                            StatusUpdate("Failed to load image", 1);
                        }
                    }
                }
                else if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                {
                    AddLog("Loading screenshot from file");
                    StatusUpdate("Offline testing with screenshot", 0);
                    LoadScreenshot();
                }
                else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    AddLog("Starting snap it");
                    StatusUpdate("Starting snap it", 0);
                    OCR.SnapScreenshot();
                }
                else if (Settings.debug || OCR.VerifyWarframe())
                {
                    Task.Factory.StartNew(() => OCR.ProcessRewardScreen());
                }
            }
        }
Пример #2
0
 private void canvas_MouseUp(object sender, MouseButtonEventArgs e)
 {
     //Release the mouse
     if (canvas.IsMouseCaptured)
     {
         canvas.ReleaseMouseCapture();
     }
     canvas.Cursor = Cursors.Arrow;
     Main.AddLog("User drew rectangle: Starting point: " + startDrag.ToString() + " Width: " + rectangle.Width + " Height:" + rectangle.Height);
     if (rectangle.Width < 10 || rectangle.Height < 10)   // box is smaller than 10x10 and thus will never be able to have any text. Also used as a failsave to prevent the program from crashing if the user makes a 0x0 sleection
     {
         Main.AddLog("User selected an area too small");
         Main.StatusUpdate("Please slecet a larger area to scan", 2);
         return;
     }
     tempImage = tempImage.Clone(new Rectangle((int)startDrag.X, (int)startDrag.Y, (int)rectangle.Width, (int)rectangle.Height), System.Drawing.Imaging.PixelFormat.DontCare);
     Task.Factory.StartNew(() => OCR.ProcessSnapIt(tempImage));
     Topmost = false;
     Hide();
 }
Пример #3
0
        private void LoadScreenshotSnap()
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                openFileDialog.Filter           = "image files (*.png)|*.png|All files (*.*)|*.*";
                openFileDialog.FilterIndex      = 2;
                openFileDialog.RestoreDirectory = true;
                openFileDialog.Multiselect      = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            foreach (string file in openFileDialog.FileNames)
                            {
                                AddLog("Testing snapit on file: " + file);

                                Bitmap image = new Bitmap(file);
                                OCR.UpdateWindow(image);
                                OCR.ProcessSnapIt(image, image, new System.Drawing.Point(0, 0));
                            }
                        }
                        catch (Exception e)
                        {
                            AddLog(e.Message);
                            StatusUpdate("Failed to load image", 1);
                        }
                    });
                }
                else
                {
                    StatusUpdate("Failed to load image", 1);
                }
            }
        }
Пример #4
0
        public void OnKeyAction(Key key)
        {
            // close the snapit overlay when *any* key is pressed down

            if (snapItOverlayWindow.isEnabled && KeyInterop.KeyFromVirtualKey((int)key) != Key.None)
            {
                snapItOverlayWindow.closeOverlay();
                return;
            }

            if (key == Settings.ActivationKey)
            { //check if user pressed activation key
                if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog())
                    {
                        openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                        openFileDialog.Filter           = "image files (*.png)|*.png|All files (*.*)|*.*";
                        openFileDialog.FilterIndex      = 2;
                        openFileDialog.RestoreDirectory = true;
                        openFileDialog.Multiselect      = true;

                        if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            Task.Factory.StartNew(() =>
                            {
                                try
                                {
                                    foreach (string file in openFileDialog.FileNames)
                                    {
                                        Main.AddLog("Testing snapit on file: " + file.ToString());

                                        Bitmap image = new Bitmap(file);
                                        OCR.ProcessSnapIt(image, image, new Point(0, 0));
                                    }
                                }
                                catch (Exception e)
                                {
                                    AddLog(e.Message);
                                    StatusUpdate("Failed to load image", 1);
                                }
                            });
                        }
                        else
                        {
                            StatusUpdate("Failed to load image", 1);
                        }
                    }
                }
                else if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                {
                    AddLog("Loading screenshot from file");
                    StatusUpdate("Offline testing with screenshot", 0);
                    LoadScreenshot();
                }
                else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    AddLog("Starting snap it");
                    StatusUpdate("Starting snap it", 0);
                    OCR.SnapScreenshot();
                }
                else if (Settings.debug || OCR.VerifyWarframe())
                {
                    //if (Ocr.verifyFocus())
                    //   Removing because a player may focus on the app during selection if they're using the window style, or they have issues, or they only have one monitor and want to see status
                    //   There's a lot of reasons why the focus won't be too useful, IMO -- Kekasi
                    Task.Factory.StartNew(() => OCR.ProcessRewardScreen());
                }
            }
        }