private void BtnProcessGrab_Click(object sender, RoutedEventArgs e) { btnProcessGrab.IsEnabled = false; listProcessList.Items.Clear(); Process[] NoxPlayers = Bot.GetOpenProcess("Nox"); if (NoxPlayers == null)//value check { MainWindow.main.UpdateLog = "null process value ProcessGrabber_Click"; return; } if (NoxPlayers != null)//enbale buttons for quest if we bind to the Nox player process { EnableButtons(); listProcessList.IsEnabled = true; listProcessList.Background = System.Windows.Media.Brushes.LightGreen; } foreach (Process pro in NoxPlayers) { if (pro == null) { MainWindow.main.UpdateLog = "null process value ProcessGrabber_Click"; return; } ListBoxItem itm = new ListBoxItem() { Content = pro.MainWindowTitle.ToString() }; listProcessList.Items.Add(itm); EmulatorCount++; } Emulators = NoxPlayers; }
/// <summary> /// Closes the pop-up window created upon closing your remote session of TeamViewer. /// TeamViewer is awesome and I would reccomend paying for it to make this go away. /// The only reason I need to close it is that it gets in the way of viewing the game screen. /// </summary> public void CloseTeamViewerPopUp() { Process[] OpenProcesses = Bot.GetOpenProcess("TeamViewer"); foreach (Process Proc in OpenProcesses) { if (Proc.MainWindowTitle == "Sponsored session") //.Equals() for null check. { int BM_CLICK = 0x00f5; //should probably be in an enum, soon. IntPtr ChildHandle = User32.FindWindowEx((IntPtr)Proc.MainWindowHandle, IntPtr.Zero, "Button", "Ok"); User32.SendMessage((int)ChildHandle, BM_CLICK, IntPtr.Zero, IntPtr.Zero); } } }
//HotKey Overload private void BtnProcessGrab_Click(object sender, HotkeyEventArgs e) { //Do NOT forget to also change overload method below if (btnProcessGrab.IsEnabled) { listProcessList.Items.Clear(); listProcessList.SelectionMode = SelectionMode.Multiple; Process[] EmulatorProcess; if (CbItemNox.IsSelected) { EmulatorProcess = Bot.GetOpenProcess("Nox"); if (EmulatorProcess == null)//value check { UpdateLog = "null process value ProcessGrabber_Click"; return; } if (EmulatorProcess != null)//enbale buttons for quest if we bind to the Nox player process { EnableButtons(); listProcessList.IsEnabled = true; listProcessList.Background = System.Windows.Media.Brushes.LightGreen; } foreach (Process pro in EmulatorProcess) { if (pro == null) { UpdateLog = "Null Process"; return; } ListBoxItem itm = new ListBoxItem() { Content = pro.MainWindowTitle.ToString() }; listProcessList.Items.Add(itm); EmulatorCount++; } Emulators = EmulatorProcess; } if (CbItemBS.IsSelected) { EmulatorProcess = Bot.GetOpenProcess("Bluestacks"); if (EmulatorProcess == null)//value check { UpdateLog = "Null process value ProcessGrabber_Click"; return; } if (EmulatorProcess != null)//enbale buttons for quest if we bind to the Nox player process { EnableButtons(); listProcessList.IsEnabled = true; listProcessList.Background = System.Windows.Media.Brushes.LightGreen; } foreach (Process pro in EmulatorProcess) { if (pro == null) { UpdateLog = "Null Process"; return; } if (pro.MainWindowTitle != "") { ListBoxItem itm = new ListBoxItem() { Content = pro.MainWindowTitle.ToString() }; listProcessList.Items.Add(itm); EmulatorCount++; } } Emulators = EmulatorProcess; } if (CbItemMEmu.IsSelected) { EmulatorProcess = Bot.GetOpenProcess("MEmu"); if (EmulatorProcess == null)//value check { UpdateLog = "Null process value ProcessGrabber_Click"; return; } if (EmulatorProcess != null)//enbale buttons for quest if we bind to the Nox player process { EnableButtons(); listProcessList.IsEnabled = true; listProcessList.Background = System.Windows.Media.Brushes.LightGreen; } foreach (Process pro in EmulatorProcess) { if (pro == null) { UpdateLog = "Null Process"; return; } if (pro.MainWindowTitle != "") { ListBoxItem itm = new ListBoxItem() { Content = pro.MainWindowTitle.ToString() }; listProcessList.Items.Add(itm); EmulatorCount++; } } Emulators = EmulatorProcess; } if (CbItemADB.IsSelected) { AndroidDebugBridge.Initialize(true); //ADB devices. List <Device> Devices = AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress); L2RDevices = new L2RDevice[Devices.Count]; //Initializes the L2RDevice array. for (int i = 0; i < Devices.Count; i++) { L2RDevices[i] = new L2RDevice(Devices[i]); EmulatorCount++; } //Enbale buttons for quest if we find ADB devices. if (Devices != null) { EnableButtons(); listProcessList.IsEnabled = true; listProcessList.Background = System.Windows.Media.Brushes.LightGreen; } foreach (L2RDevice Device in L2RDevices) { if (Device.CharacterName == null) { UpdateLog = "Unable to find Character name"; } ListBoxItem itm = new ListBoxItem() { Content = Device.CharacterName }; listProcessList.Items.Add(itm); } } if (listProcessList.HasItems) { btnProcessGrab.IsEnabled = false; } UpdateLog = "Select any process that you would like the bot to ignore."; } }