コード例 #1
0
ファイル: ReloggerEventArgs.cs プロジェクト: Vipeax/GW2WinMan
 internal ReloggerEventArgs(AccountClass account = null, Scheduler scheduler = null,
                            ERelogEventArgsType type = ERelogEventArgsType.OnUnknown)
 {
     Account = account;
     Scheduler = scheduler;
     Type = type;
 }
コード例 #2
0
ファイル: Config.cs プロジェクト: Vipeax/GW2WinMan
 internal void AddScheduler(Scheduler scheduler)
 {
     Logger.LoggingObject.Log(Level.Debug, "Added new scheduler object.");
     Logger.LoggingObject.Log(Level.Debug, "[Start: {0} -- {1}, End: {2} -- {3}, Duration in minutes: {4}].",
                              scheduler.StartTime.ToShortDateString(), scheduler.StartTime.ToShortTimeString(),
                              scheduler.EndTime.ToShortDateString(), scheduler.EndTime.ToShortTimeString(),
                              (scheduler.EndTime - scheduler.StartTime).TotalMinutes);
     SchedulerSettings.Add(scheduler);
     AccountSettings.Add(scheduler.Account);
     scheduler.Account.SetIndex(AccountSettings.Count - 1);
 }
コード例 #3
0
ファイル: WatchObject.cs プロジェクト: Vipeax/GW2WinMan
 internal WatchObject(Scheduler scheduler, DateTime time)
 {
     Scheduler = scheduler;
     Time = time;
 }
コード例 #4
0
ファイル: Config.cs プロジェクト: Vipeax/GW2WinMan
 internal void DeleteScheduler(Scheduler scheduler)
 {
     if (AccountSettings.Any(ac => ac.LoginName == scheduler.Account.LoginName))
     {
         AccountSettings.Remove(AccountSettings.FirstOrDefault(ac => ac.LoginName == scheduler.Account.LoginName));
     }
     SchedulerSettings.Remove(
         SchedulerSettings.FirstOrDefault(
             s =>
             s.Account.LoginName == scheduler.Account.LoginName &&
             s.Account.Password == scheduler.Account.Password));
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: Vipeax/GW2WinMan
 private void StopSessionOfExpiredSchedule(Scheduler schedule)
 {
     Logger.LoggingObject.Log(Level.Info,
                              "Stopping {0}, bot has been running for {1:0.##} minutes.",
                              schedule.Account.LoginName,
                              (DateTime.Now - schedule.StartTime).TotalMinutes);
     Logger.LoggingObject.Log(Level.Info, "Start time: {0}, End time: {0}.",
                              schedule.StartTime.ToShortTimeString(),
                              DateTime.Now);
     schedule.SetShouldBeRunning(false);
     schedule.Account.Kill();
     LauncherCustomControls[schedule.Account.Index].BtnKill.Invoke(
         (MethodInvoker)
         (() =>
          LauncherCustomControls[schedule.Account.Index].BtnKill.Enabled = false));
     LauncherCustomControls[schedule.Account.Index].BtnStart.Invoke(
         (MethodInvoker)
         (() =>
          LauncherCustomControls[schedule.Account.Index].BtnStart.Enabled = false));
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: Vipeax/GW2WinMan
        private string SetBotPath(Scheduler scheduler)
        {
            var openFolderDialog = new FolderBrowserDialog();

            MessageBox.Show("Please locate your desired GW2Minion folder.", "Locate GW2Minion folder");
            while (
                openFolderDialog.ShowDialog() !=
                DialogResult.OK || !Directory.Exists(openFolderDialog.SelectedPath)) ;
            scheduler.SetBotPath(openFolderDialog.SelectedPath);
            return openFolderDialog.SelectedPath;
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: Vipeax/GW2WinMan
 private void SetIsRunning(Scheduler schedule)
 {
     LauncherCustomControls[schedule.Account.Index].LblStatus.Invoke(
         (MethodInvoker)
         (() => LauncherCustomControls[schedule.Account.Index].LblStatus.Text = "Running!"));
 }
コード例 #8
0
ファイル: AccountClass.cs プロジェクト: Vipeax/GW2WinMan
 private uint CreateNewProcess(bool attached, Scheduler wanted, uint newPID)
 {
     if (!attached)
     {
         try
         {
             try
             {
                 if (Directory.Exists(wanted.BotPath) &&
                     File.Exists(wanted.BotPath + "\\GW2MinionLauncherDLL.dll"))
                     SetDllDirectory(wanted.BotPath);
                 Logger.LoggingObject.Log(Level.Verbose, "Launching instance for {0} with {1}.",
                                          LoginName, wanted.BotPath + "\\GW2MinionLauncherDLL.dll");
                 newPID = LaunchAccount(Config.Singleton.GeneralSettings.GW2Path, LoginName, Password, NoSound);
             }
             catch (AccessViolationException ex)
             {
                 Logger.LoggingObject.Log(Level.Critical, ex.Message);
             }
             wanted.SetLastStartTime(DateTime.Now);
             wanted.SetShouldBeRunning(true);
         }
         catch (DllNotFoundException ex)
         {
             Logger.LoggingObject.Log(Level.Error, ex.Message);
         }
         catch (BadImageFormatException ex)
         {
             Logger.LoggingObject.Log(Level.Error, ex.Message);
         }
     }
     return newPID;
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: Vipeax/GW2WinMan
 private void EnableButtonsOfAccount(Scheduler schedule)
 {
     LauncherCustomControls[schedule.Account.Index].BtnKill.Invoke(
         (MethodInvoker)
         (() =>
          LauncherCustomControls[schedule.Account.Index].BtnKill.Enabled = true));
     LauncherCustomControls[schedule.Account.Index].BtnStart.Invoke(
         (MethodInvoker)
         (() =>
          LauncherCustomControls[schedule.Account.Index].BtnStart.Enabled = true));
 }
コード例 #10
0
ファイル: AccountClass.cs プロジェクト: Vipeax/GW2WinMan
        private bool CheckIfProcessAlreadyExists(Process[] gw2, Scheduler wanted, bool attached, ref uint newPID)
        {
            foreach (Process p in gw2)
            {
                if (GetAccountName((uint) p.Id) == LoginName)
                {
                    Logger.LoggingObject.Log(Level.Verbose, "Found wanted process for {0}, no need to launch.",
                                             LoginName);
                    try
                    {
                        Logger.LoggingObject.Log(Level.Verbose, "Attaching to {0} with {1}.",
                                                 LoginName, wanted.BotPath + "\\GW2MinionLauncherDLL.dll");
                        if (Directory.Exists(wanted.BotPath) &&
                            File.Exists(wanted.BotPath + "\\GW2MinionLauncherDLL.dll"))
                            SetDllDirectory(wanted.BotPath);
                        attached = Attach((uint) p.Id);
                    }
                    catch (AccessViolationException ex)
                    {
                        Logger.LoggingObject.Log(Level.Critical, ex.Message);
                    }
                    newPID = (uint) p.Id;

                    wanted.SetLastStartTime(DateTime.Now);
                    wanted.SetShouldBeRunning(true);
                }
            }
            return attached;
        }
コード例 #11
0
ファイル: Functionality.cs プロジェクト: Vipeax/GW2WinMan
 private static void UpdateStatusToRunning(Scheduler schedule)
 {
     _form.LauncherCustomControls[schedule.Account.Index].LblStatus.Invoke(
         (MethodInvoker)
         (() => _form.LauncherCustomControls[schedule.Account.Index].LblStatus.Text = "Running!"));
 }
コード例 #12
0
ファイル: Functionality.cs プロジェクト: Vipeax/GW2WinMan
 private static void StopSchedule(Scheduler schedule, bool ipChange = false)
 {
     if (ipChange)
         Logger.LoggingObject.Log(Level.Critical,
                                  "Stopping {0}, external IP has changed and is not validated by the user. HELP!",
                                  schedule.Account.LoginName);
     schedule.Account.Kill();
 }
コード例 #13
0
ファイル: Functionality.cs プロジェクト: Vipeax/GW2WinMan
 private static void StartSchedule(Scheduler schedule)
 {
     if ((DateTime.Now - schedule.LastStart).TotalSeconds > Config.Singleton.GeneralSettings.RestartDelay + 60 &&
         (DateTime.Now - schedule.LastStop).TotalSeconds > Config.Singleton.GeneralSettings.RestartDelay)
     {
         if (!Config.Singleton.GeneralSettings.CheckForIP ||
             GetMyIP.ListContainsMyIPAddress(Config.Singleton.GeneralSettings.AllowedIPAddresses))
         {
             schedule.Account.Start();
             Logger.LoggingObject.Log(Level.Info, "Starting GW2 instance for {0}.",
                                      schedule.Account.LoginName);
             Logger.LoggingObject.Log(Level.Info,
                                      "Waiting {0} seconds before starting any other instances.",
                                      Config.Singleton.GeneralSettings.LaunchDelay/1000);
         }
         else
         {
             Logger.LoggingObject.Log(Level.Verbose,
                                      "Not launching, current external IP address has not been permitted by the user.");
         }
     }
     else
     {
         Logger.LoggingObject.Log(Level.Verbose,
                                  "Not launching, session {0} was active recently. Need to avoid key limitations!",
                                  schedule.Account.LoginName);
     }
 }
コード例 #14
0
ファイル: Functionality.cs プロジェクト: Vipeax/GW2WinMan
 private static void EnableButtons(Scheduler schedule)
 {
     _form.LauncherCustomControls[schedule.Account.Index].BtnKill.Invoke(
         (MethodInvoker)
         (() =>
          _form.LauncherCustomControls[schedule.Account.Index].BtnKill.Enabled = true));
     _form.LauncherCustomControls[schedule.Account.Index].BtnStart.Invoke(
         (MethodInvoker)
         (() =>
          _form.LauncherCustomControls[schedule.Account.Index].BtnStart.Enabled = true));
 }