Ejemplo n.º 1
0
        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);
        }
 private static void UpdateProcessIdForMatchingScheduler(Process gw2Process)
 {
     if (Config.Singleton.AccountSettings.All(a => a.PID != gw2Process.Id))
     {
         string  name   = GW2MinionLauncher.GetAccountName((uint)gw2Process.Id);
         Account wanted =
             Config.Singleton.AccountSettings.FirstOrDefault(a => a.LoginName == name);
         if (wanted != null)
         {
             wanted.SetPID((uint)gw2Process.Id);
             wanted.SetLastStartTime(DateTime.Now);
         }
     }
 }