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()); } } }
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()); } } }
private void LoadScreenshot() { // Using WinForms for the openFileDialog because it's simpler and much easier 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 file: " + file); //Get the path of specified file Bitmap image = new Bitmap(file); OCR.UpdateWindow(image); OCR.ProcessRewardScreen(image); } } catch (Exception e) { AddLog(e.Message); StatusUpdate("Failed to load image", 1); } }); } else { StatusUpdate("Failed to load image", 1); OCR.processingActive = false; } } }
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) { AddLog("Loading screenshot from file"); StatusUpdate("Offline testing with screenshot", 0); LoadScreenshot(); } else if (Settings.debug && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { AddLog("Starting snap it"); StatusUpdate("Single item pricecheck", 0); OCR.SnapScreenshot(); } else if (Settings.debug || OCR.VerifyWarframe()) { Task.Factory.StartNew(() => OCR.ProcessRewardScreen()); } } }
public static void AutoTriggered() { try { var watch = Stopwatch.StartNew(); long stop = watch.ElapsedMilliseconds + 5000; long wait = watch.ElapsedMilliseconds; OCR.UpdateWindow(); int diff; while (watch.ElapsedMilliseconds < stop) { if (watch.ElapsedMilliseconds > wait) { wait += Settings.autoDelay; diff = OCR.GetThemeThreshold(); if (diff < 5) { while (watch.ElapsedMilliseconds < wait) { ; } OCR.ProcessRewardScreen(); break; } } } watch.Stop(); } catch (Exception ex) { Main.AddLog("AUTO FAILED"); Main.AddLog(ex.ToString()); Main.StatusUpdate("Auto Detection Failed", 0); new ErrorDialogue(DateTime.Now, 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()); } } }
public void OnMouseAction(MouseButton key) { latestActive = DateTime.UtcNow.AddMinutes(minutesTillAfk); if (Settings.ActivationMouseButton != MouseButton.Left && key == Settings.ActivationMouseButton) { //check if user pressed activation key 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(); } } return; } if (searchBox.IsInUse) { //if key is pressed and searchbox is active then rederect keystokes to it. if (Keyboard.IsKeyDown(Key.Escape)) { // close it if esc is used. searchBox.Finish(); return; } searchBox.searchField.Focus(); 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()); } } else if (key == MouseButton.Left && OCR.Warframe != null && !OCR.Warframe.HasExited && Overlay.rewardsDisplaying) { Task.Run((() => { lastClick = System.Windows.Forms.Cursor.Position; var index = OCR.GetSelectedReward(lastClick); Debug.WriteLine(index); if (index < 0) { return; } listingHelper.SelectedRewardIndex = (short)index; })); } }
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()); } } }