// Method that runs update process public static void processUpdateRequest() { if (Common.Raffle != null && Common.Raffle.raffleIsActive()) { Console.WriteLine("Update request placed in command queue."); return; } UpdateDetails details = WebCalls.downloadUpdateDetails().Result; if (!details.RequestSuccessful || !details.UpdateAvailable) { Console.WriteLine("RequestSuccessful: " + details.RequestSuccessful + ", UpdateAvailable: " + details.UpdateAvailable); return; } Console.WriteLine("Downloading new bot and updater..."); WebCalls.downloadFile(details.DownloadLocation, "bot.exe"); Console.WriteLine("new bot downloaded"); WebCalls.downloadFile(details.UpdaterLocation, "updater.exe"); Console.WriteLine("Finished! Starting updater and exiting."); System.Diagnostics.ProcessStartInfo pInfo = new System.Diagnostics.ProcessStartInfo(); pInfo.FileName = "updater.exe"; pInfo.ErrorDialog = true; pInfo.UseShellExecute = false; pInfo.RedirectStandardOutput = true; pInfo.RedirectStandardError = true; pInfo.WorkingDirectory = Path.GetDirectoryName("updater.exe"); System.Diagnostics.Process.Start(pInfo); Environment.Exit(1); }
public UpdateData(UpdateDetails details) { this.details = details; }