Esempio n. 1
0
 private void CheckIfUpdateEnableAndStart()
 {
     if (UserSettings.PlayerConfig.HunterPie.Update.Enabled)
     {
         bool     justUpdated   = false;
         bool     latestVersion = false;
         string[] args          = Environment.GetCommandLineArgs();
         foreach (string argument in args)
         {
             if (argument.StartsWith("justUpdated"))
             {
                 string parsed = ParseArgs(argument);
                 justUpdated = parsed == "True";
             }
             if (argument.StartsWith("latestVersion"))
             {
                 string parsed = ParseArgs(argument);
                 latestVersion = parsed == "True";
             }
         }
         if (justUpdated)
         {
             openChangeLog();
             return;
         }
         if (latestVersion)
         {
             return;
         }
         // This will update Update.exe
         AutoUpdate au = new AutoUpdate(UserSettings.PlayerConfig.HunterPie.Update.Branch);
         au.checkAutoUpdate();
         if (au.offlineMode)
         {
             Debugger.Error("Failed to update HunterPie. Check if you're connected to the internet.");
             Debugger.Warn("HunterPie is now in offline mode.");
             Discord.SetOfflineMode();
             return;
         }
         bool StartUpdate = StartUpdateProcess();
         if (StartUpdate)
         {
             Environment.Exit(0);
         }
         else
         {
             MessageBox.Show("Update.exe not found! Skipping auto-update...", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         Debugger.Error("Auto-update is disabled. If your HunterPie has any issues or doesn't support the current game version, try re-enabling auto-update!");
     }
 }