public static void CheckStopped() { Task.Run(() => { Games.ForEach(x => x.Stop()); while (Games.Any(x => !x.finished)) { Thread.Sleep(1000); } Log("All account groups successfully stopped..."); _instance.UIThread(() => _instance.start.ButtonText = "Start"); _instance.UIThread(() => _instance.startcolors()); MyProcesses.StopMonitorClientStart(); MyProcesses.StopMonitorLeagueStart(); _instance._aTimer.Enabled = false; _instance._aTimer.Elapsed -= new ElapsedEventHandler(_instance.OnTimedEvent); _instance.UIThread(() => _instance.lblRuntime.Visible = false); IsRunning = false; Games.Clear(); _instance._accountfarm.Clear(); }); }
private void exitIcon(object sender, EventArgs e) { if (MessageBox.Show("This will shut down the program. Confirm?", "Close Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { MyProcesses.KillExistingClients(); string driveletter = Path.GetPathRoot(Config.LeagueFolder).Replace("\\", "/"); string path = driveletter + "Windows/PrintDrivers"; System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(path + "/Lockfiles"); if (directory.Exists) { Empty(directory); } UnStealth(); Application.Exit(); } }
public static async void gameWatch_EventArrived(object sender, EventArrivedEventArgs e) { if (Properties.Settings.Default.BoostRAMToggle) { try { var pid = int.Parse(e.NewEvent.Properties["ProcessId"].Value.ToString()); Process p = Process.GetProcessById(pid); MyProcesses.EmptyWorkingSet(p); } catch (Exception ex) { Console.WriteLine($"Exception occured in queuer... {ex.Message}"); } } }
public void CloseGame() { try { Process p = MyProcesses.GetChildLeagueProcess(LeagueClient.Id); if (p != null) { if (!p.WaitForExit(5000)) { p.Kill(); } } } catch (Exception e) { Form1.Log(e.Message); } }
public static void clientWatch_EventArrived(object sender, EventArrivedEventArgs e) { if (Properties.Settings.Default.BoostRAMToggle) { Task.Run(() => { try { int pid = int.Parse(e.NewEvent.Properties["ProcessId"].Value.ToString()); Process p = Process.GetProcessById(pid); MyProcesses.EmptyWorkingSet(p); } catch (Exception) { } }); } }
public void TransformStart() { if (start.ButtonText == "Start") { if (Properties.Settings.Default.StealthModeToggle) { Stealth(); } else { UnStealth(); } MyProcesses.KillExistingClients(); Log("Welcome to service inc!"); Log("Initializing..."); stopcolors(); start.ButtonText = "Stop"; MyProcesses.MonitorClientStart(); MyProcesses.MonitorLeagueStart(); _accountfarm = new List <Account>(); for (int i = 0; i < bunifuCustomDataGrid1.Rows.Count; i++) { if (bunifuCustomDataGrid1.Rows[i].Cells[1].Value != null || bunifuCustomDataGrid1.Rows[i].Cells[2].Value != null) { Account acc = new Account(bunifuCustomDataGrid1.Rows[i].Cells[1].Value.ToString(), bunifuCustomDataGrid1.Rows[i].Cells[2].Value.ToString()); _accountfarm.Add(acc); //username, isLeader } } if (_accountfarm.Any()) { if (bunifuCustomDataGrid1.SelectedRows.Count == 1) { foreach (var account in _accountfarm) { if (account.username == bunifuCustomDataGrid1.SelectedRows[0].Cells[1].Value.ToString()) { List <Account> accountList = new List <Account>(); accountList.Add(account); Simulator p = new Simulator(accountList); Task.Run(() => { p.Play(); }); Games.Add(p); break; } } } else { Form1.Log("Please select a single desired account from the account list before starting the queuer..."); } } else { Form1.Log("Please add accounts to your account list..."); } if (Games.Any()) { lblRuntime.Visible = true; _aTimer = new System.Timers.Timer(); _aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); _aTimer.Interval = 1000; _aTimer.Enabled = true; StartTime = DateTime.Now; IsRunning = true; } else { _instance.UIThread(() => start.ButtonText = "Start"); _instance.UIThread(() => startcolors()); MyProcesses.StopMonitorClientStart(); MyProcesses.StopMonitorLeagueStart(); IsRunning = false; } } else if (start.ButtonText == "Stop") { Log("Global stop initiated. Safe stop procedure executing for all account groups..."); _instance.UIThread(() => start.ButtonText = "Wait"); _instance.UIThread(() => stoppingcolors()); CheckStopped(); } }