Exemple #1
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)
                {
                    AddLog("Loading screenshot from file");
                    StatusUpdate("Offline testing with screenshot", 0);
                    LoadScreenshot();
                }
                else if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    AddLog("Starting snap it");
                    StatusUpdate("Single item pricecheck", 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());
                }
            }
        }
Exemple #2
0
        public void OnKeyAction(Key key)
        {
            latestActive = DateTime.UtcNow.AddMinutes(minutesTillAfk);

            // close the snapit overlay when *any* key is pressed down
            if (snapItOverlayWindow.isEnabled && KeyInterop.KeyFromVirtualKey((int)key) != Key.None)
            {
                snapItOverlayWindow.closeOverlay();
                StatusUpdate("Closed snapit", 0);
                return;
            }
            if (searchBox.IsInUse)
            {     //if key is pressed and searchbox is active then rederect keystokes to it.
                if (key == Key.Escape)
                { // close it if esc is used.
                    searchBox.Finish();
                    return;
                }
                searchBox.searchField.Focus();
                return;
            }


            if (key == Settings.ActivationKey)
            { //check if user pressed activation key
                Main.AddLog($"User is activating with pressing key: {key} and is holding down:\n" +
                            $"Delete:{Keyboard.IsKeyDown(Key.Delete)}\n" +
                            $"Snapit, {Settings.SnapitModifierKey}:{Keyboard.IsKeyDown(Settings.SnapitModifierKey)}\n" +
                            $"Searchit, {Settings.SearchItModifierKey}:{Keyboard.IsKeyDown(Settings.SearchItModifierKey)}\n" +
                            $"debug, {Settings.DebugModifierKey}:{Keyboard.IsKeyDown(Settings.DebugModifierKey)}");
                if (Keyboard.IsKeyDown(Key.Delete))
                { //Close all overlays if hotkey + delete is held down
                    foreach (Window overlay in App.Current.Windows)
                    {
                        if (overlay.GetType().ToString() == "WFInfo.Overlay")
                        {
                            overlay.Hide();
                        }
                    }
                    StatusUpdate("Overlays dismissed", 1);
                    return;
                }
                if (Settings.debug && Keyboard.IsKeyDown(Settings.DebugModifierKey) && Keyboard.IsKeyDown(Settings.SnapitModifierKey))
                { //snapit debug
                    AddLog("Loading screenshot from file for snapit");
                    StatusUpdate("Offline testing with screenshot for snapit", 0);
                    LoadScreenshotSnap();
                }
                else if (Settings.debug && Keyboard.IsKeyDown(Settings.DebugModifierKey))
                {//normal debug
                    AddLog("Loading screenshot from file");
                    StatusUpdate("Offline testing with screenshot", 0);
                    LoadScreenshot();
                }
                else if (Keyboard.IsKeyDown(Settings.SnapitModifierKey))
                {//snapit
                    AddLog("Starting snap it");
                    StatusUpdate("Starting snap it", 0);
                    OCR.SnapScreenshot();
                }
                else if (Keyboard.IsKeyDown(Settings.SearchItModifierKey))
                { //Searchit
                    AddLog("Starting search it");
                    StatusUpdate("Starting search it", 0);
                    searchBox.Start();
                }
                else if (Settings.debug || OCR.VerifyWarframe())
                {
                    Task.Factory.StartNew(() => OCR.ProcessRewardScreen());
                }
            }
        }
Exemple #3
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());
                }
            }
        }