Esempio n. 1
0
        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();
            });
        }
Esempio n. 2
0
        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();
            }
        }