public bool IsReady(Account account) { return !account.AttachBot2 && ((DateTime.Now - account.LastCrash).TotalSeconds <= Config.Singleton.GeneralSettings.RestartDelay || (DateTime.Now - account.LastStop).TotalSeconds <= Config.Singleton.GeneralSettings.RestartDelay || (DateTime.Now - account.LastStart).TotalSeconds <= Config.Singleton.GeneralSettings.RestartDelay); }
public void Update(Account account) { Logger.LoggingObject.Log(ELogType.Info, LanguageManager.Singleton.GetTranslation(ETranslations.KillWorkerStoppingProcess), account.PID); account.SetLastStopTime(DateTime.Now); }
public ViewStateObject(Account account, DateTime time, Process process, EViewState viewstate) { Account = account; Time = time; Process = process; ViewState = viewstate; }
private bool CheckIfProcessAlreadyExists(IEnumerable<Process> gw2Processes, Account account, bool attached, ref uint newPID) { foreach (Process p in gw2Processes) { if (GW2MinionLauncher.GetAccountName((uint) p.Id) == account.LoginName) { Logger.LoggingObject.Log(ELogType.Verbose, LanguageManager.Singleton.GetTranslation( ETranslations.StartWorkerFoundWantedProcess), account.LoginName); try { Logger.LoggingObject.Log(ELogType.Verbose, LanguageManager.Singleton.GetTranslation( ETranslations.StartWorkerAttachingTo), account.LoginName, account.BotPath + "\\GW2MinionLauncherDLL.dll"); attached = GW2MinionLauncher.AttachToPid((uint) p.Id, Config.Singleton.GeneralSettings.UseBeta); } catch (Exception ex) { Logger.LoggingObject.Log(ELogType.Critical, ex.Message); } newPID = (uint) p.Id; account.SetLastStartTime(DateTime.Now); account.SetShouldBeRunning(true); } } return attached; }
public bool IsReady(Account account) { return Config.Singleton.AccountSettings.Any( acc => (DateTime.Now - acc.LastStart).TotalSeconds < Config.Singleton.GeneralSettings.LaunchDelay); }
public AccountForm(EAccountManagementType type, Account account = null) { InitializeComponent(); _account = account; _type = type; // metroToggle2.Checked = true; metroStyleManager.Theme = Config.Singleton.GeneralSettings.ThemeSetting; metroStyleManager.Style = Config.Singleton.GeneralSettings.StyleSetting; switch (type) { case EAccountManagementType.Add: btnDelete.Visible = false; Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountFormAddAccount); break; case EAccountManagementType.Edit: btnDelete.Visible = true; Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountFormEditAccount); break; } if (account != null) { txtBoxLoginName.Text = account.LoginName.Replace(@"""", ""); txtBoxPassword.Text = account.Password; metroToggle1.Checked = account.NoSound; metroToggle2.Checked = account.AttachBot2; metroToggle3.Checked = account.UseCustomGW2Path; txtBoxCustomPath.Text = account.CustomGW2Path; } }
public IRelogComponent DoWork(Account account, ref ComponentResult result) { if (Check(account)) { result = new ComponentResult { Result = EComponentResult.Continue, }; if (IsReady(account)) { result = new ComponentResult { Result = EComponentResult.Halt, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.IPCheckComponentHalt), }; if (account.Running) result = new ComponentResult { Result = EComponentResult.Kill, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.IPCheckComponentKill), }; } } else { result = new ComponentResult { Result = EComponentResult.Ignore, }; } return this; }
internal AccountControl(MetroTabControl tabControl, int totalCount, int activeCount, int newSet, MetroStyleManager styleManager, Account account) { _account = account; FixControls(newSet, styleManager, account); AddControlsToForm(tabControl, styleManager, activeCount, newSet); ID = totalCount; BindEvents(); }
public SettingsForm(Account account) { InitializeComponent(); metroStyleManager.Theme = Config.Singleton.GeneralSettings.ThemeSetting; metroStyleManager.Style = Config.Singleton.GeneralSettings.StyleSetting; _account = account; BindEvents(); SetTimeFields(); metroToggle1.Checked = _account.EnableScheduling; }
public bool Check(Account account) { if (account.EnableScheduling) { double differenceFuture = (DateTime.Now - account.EndTime).TotalSeconds; double differencePast = (account.StartTime - DateTime.Now).TotalSeconds; return differenceFuture > 0 || differencePast > 0; } return false; }
public IRelogWorker DoWork(Account account) { _attached = false; _newPID = uint.MaxValue; _gw2Processes = Process.GetProcessesByName("gw2"); Logger.LoggingObject.Log(ELogType.Debug, LanguageManager.Singleton.GetTranslation( ETranslations.StartWorkerScanningForExisting)); _attached = Check(account); _newPID = CreateNewProcess(_attached, account, ref _newPID); Update(account); return this; }
public SettingsForm(Account account) { InitializeComponent(); _account = account; metroStyleManager.Theme = Config.Singleton.GeneralSettings.ThemeSetting; metroStyleManager.Style = Config.Singleton.GeneralSettings.StyleSetting; if (account.BreakObject != null) { numericUpDown1.Value = account.BreakObject.Interval; numericUpDown2.Value = account.BreakObject.IntervalDelay; numericUpDown3.Value = account.BreakObject.BreakDuration; numericUpDown4.Value = account.BreakObject.BreakDurationDelay; metroToggle1.Checked = account.BreakObject.BreakEnabled; } }
public IRelogWorker DoWork(Account account) { _attached = false; _newPID = uint.MaxValue; if (account.UseCustomGW2Path == true) _gw2Processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(account.CustomGW2Path).ToLower()); else _gw2Processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(Config.Singleton.GeneralSettings.GW2Path).ToLower()); Logger.LoggingObject.Log(ELogType.Debug, LanguageManager.Singleton.GetTranslation( ETranslations.StartWorkerScanningForExisting)); _attached = Check(account); _newPID = CreateNewProcess(_attached, account, ref _newPID); Update(account); return this; }
public IRelogWorker DoWork(Account account) { if (Check(account)) { try { Process[] processes = Process.GetProcessesByName("GW2"); if (processes.Any(p => p.Id == account.PID)) _done = GW2MinionLauncher.KillInstance(account.PID); Thread.Sleep(3000); } catch { } } return this; }
public IRelogComponent DoWork(Account account, ref ComponentResult result) { if (Check(account)) { Update(account); result = new ComponentResult { Result = EComponentResult.Start, }; } else { result = new ComponentResult { Result = EComponentResult.Ignore, }; } return this; }
public IRelogComponent DoWork(Account account, ref ComponentResult result) { if (!account.RestartDelayActive && Check(account)) { account.SetRestartDelayActive(true); account.SetLastStopTime(DateTime.Now); } result = IsReady(account) ? new ComponentResult { Result = EComponentResult.Halt, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.RestartDelayComponentHalt), } : new ComponentResult { Result = EComponentResult.Ignore, }; return this; }
public IRelogComponent DoWork(Account account, ref ComponentResult result) { if (account.BreakObject != null && account.BreakObject.Check()) { if (account.BreakObject.IsReady()) { result = Check(account) ? new ComponentResult { Result = EComponentResult.Kill, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.BreakComponentKill), } : new ComponentResult { Result = EComponentResult.Halt, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.BreakComponentHalt), }; } else { result = new ComponentResult { Result = EComponentResult.Continue, }; } } else { result = new ComponentResult { Result = EComponentResult.Ignore, }; } if (IsReady(account)) { Update(account); } return this; }
public IRelogComponent DoWork(Account account, ref ComponentResult result) { if (Check(account)) { result = new ComponentResult { Result = EComponentResult.Halt, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.BasicStopComponentHalt), }; if (IsReady(account)) { if (!account.PerformedCheck) { account.PerformedCheck = true; if (account.Running) account.SetShouldBeRunning(true); result = new ComponentResult { Result = EComponentResult.ContinueForced, }; } else { result = new ComponentResult { Result = EComponentResult.Kill, LogMessage = LanguageManager.Singleton.GetTranslation(ETranslations.BasicStopComponentStop), }; } Update(account); } } else { result = new ComponentResult { Result = EComponentResult.Ignore, }; } return this; }
public IRelogWorker DoWork(Account account) { if (Check(account)) { try { Process[] processes; if (account.UseCustomGW2Path == true) processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(account.CustomGW2Path)); else processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(Config.Singleton.GeneralSettings.GW2Path)); if (processes.Any(p => p.Id == account.PID)) _done = GW2MinionLauncher.KillInstance(account.PID); Thread.Sleep(3000); } catch { } } return this; }
public bool Check(Account account) { return Config.Singleton.GeneralSettings.CheckForIP; }
public void Update(Account account) { }
public Form ShowSettingsForm(Account account = null) { return new SettingsForm(); }
public void PostWork(Account account) { }
public void OpenSettingsForm(string nameofComponentToCall, Account account = null) { ComponentClass first = _components.FirstOrDefault(c => c.Component.GetName() == nameofComponentToCall); if (first != null) { OpenSettingsForm(first.Component, account); } }
public void OpenSettingsForm(IRelogComponent componentToCall, Account account = null) { componentToCall.ShowSettingsForm(account).ShowDialog(); }
private void BtnOkClick(object sender, EventArgs e) { switch (_type) { case EAccountManagementType.Add: if (!string.IsNullOrEmpty(txtBoxLoginName.Text) && !string.IsNullOrEmpty(txtBoxPassword.Text) && Config.Singleton.AccountSettings.All(account => account.LoginName != txtBoxLoginName.Text)) { var toAdd = new Account(); string pass = txtBoxPassword.Text; if (!pass.Contains(@"""")) pass = @"""" + pass + @""""; toAdd.SetLoginName(txtBoxLoginName.Text); toAdd.SetPassword(pass); toAdd.SetBotPath(AppDomain.CurrentDomain.BaseDirectory); toAdd.SetEndTime(DateTime.Now.AddYears(1337)); toAdd.SetManuallyScheduled(false); toAdd.SetNoSound(metroToggle1.Checked); toAdd.SetAttachBot(metroToggle2.Checked); toAdd.SetUseCostumGW2Path(metroToggle3.Checked); toAdd.SetCostumGW2Path(txtBoxCustomPath.Text); Config.Singleton.AddAccount(toAdd); } break; case EAccountManagementType.Edit: Account wanted = Config.Singleton.AccountSettings.FirstOrDefault( account => account.LoginName == _account.LoginName); if (wanted != null) { string pass = txtBoxPassword.Text; if (!pass.Contains(@"""")) pass = @"""" + pass + @""""; wanted.SetPassword(pass); wanted.SetNoSound(metroToggle1.Checked); wanted.SetLoginName(txtBoxLoginName.Text); wanted.SetAttachBot(metroToggle2.Checked); try { wanted.SetUseCostumGW2Path(metroToggle3.Checked); wanted.SetCostumGW2Path(txtBoxCustomPath.Text); } catch { } } break; } Close(); }
public bool Check(Account account) { return !account.Running; }
public void Update(Account account) { account.SetRestartDelayActive(false); account.SetPID(_newPID); account.SetLastStartTime(DateTime.Now); }
public bool IsReady(Account account) { return !GetMyIP.ListContainsMyIPAddress(Config.Singleton.GeneralSettings.AllowedIPAddresses); }
public bool PostWork(Account account) { return _newPID < uint.MaxValue; }