public void ForceUpdate() { isStartingForceUpdate = true; lblDescription.Text = $"Force updating {MainClientConstants.GAME_NAME_SHORT} to latest version..."; lblUpdaterStatus.Text = "Connecting"; CUpdater.CheckForUpdates(); }
/// <summary> /// Called when the user has accepted an update. /// </summary> private void UpdateQueryWindow_UpdateAccepted(object sender, EventArgs e) { innerPanel.Hide(); innerPanel.UpdateWindow.SetData(CUpdater.ServerGameVersion); innerPanel.Show(innerPanel.UpdateWindow); lblUpdateStatus.Text = "Updating..."; UpdateInProgress = true; CUpdater.StartAsyncUpdate(); }
/// <summary> /// Starts a check for updates. /// </summary> private void CheckForUpdates() { CUpdater.CheckForUpdates(); lblUpdateStatus.Enabled = false; lblUpdateStatus.Text = "Checking for updates..."; try { StatisticsSender.Instance.SendUpdate(); } catch { } lastUpdateCheckTime = DateTime.Now; }
private bool AreFilesModified() { foreach (string filePath in filesToCheck) { if (!CUpdater.IsFileNonexistantOrOriginal(filePath)) { return(true); } } return(false); }
private void BtnLaunch_LeftClick(object sender, EventArgs e) { int selectedMissionId = lbCampaignList.SelectedIndex; Mission mission = Missions[selectedMissionId]; if (!ClientConfiguration.Instance.ModMode && (!CUpdater.IsFileNonexistantOrOriginal(mission.Scenario) || AreFilesModified())) { // Confront the user by showing the cheater screen missionToLaunch = mission; cheaterWindow.Enable(); return; } LaunchMission(mission); }
private void CUpdater_FileIdentifiersUpdated() { if (!isStartingForceUpdate) { return; } if (CUpdater.DTAVersionState == VersionState.UNKNOWN) { XNAMessageBox.Show(WindowManager, "Force Update Failure", "Checking for updates failed."); CloseWindow(); return; } SetData(CUpdater.ServerGameVersion); CUpdater.StartAsyncUpdate(); isStartingForceUpdate = false; }
private void BtnLaunch_LeftClick(object sender, EventArgs e) { var mission = lbCampaignList.SelectedItem.Tag as Mission; isCheater = false; missionToLaunch = mission; if (!ClientConfiguration.Instance.ModMode && (!CUpdater.IsFileNonexistantOrOriginal(mission.Scenario) || AreFilesModified())) { // Confront the user by showing the cheater screen isCheater = true; cheaterWindow.Enable(); return; } PostCheaterWindow(); }
/// <summary> /// The main method for startup and initialization. /// </summary> public void Execute() { string themePath = ClientConfiguration.Instance.GetThemePath(UserINISettings.Instance.ClientTheme); if (themePath == null) { themePath = ClientConfiguration.Instance.GetThemeInfoFromIndex(0)[1]; } ProgramConstants.RESOURCES_DIR = "Resources\\" + themePath; if (!Directory.Exists(ProgramConstants.RESOURCES_DIR)) { throw new DirectoryNotFoundException("Theme directory not found!" + Environment.NewLine + ProgramConstants.RESOURCES_DIR); } Logger.Log("Initializing updater."); File.Delete(ProgramConstants.GamePath + "version_u"); CUpdater.Initialize(ClientConfiguration.Instance.LocalGame); Logger.Log("Operating system: " + Environment.OSVersion.VersionString); Logger.Log("Selected OS profile: " + MainClientConstants.OSId.ToString()); // The query in CheckSystemSpecifications takes lots of time, // so we'll do it in a separate thread to make startup faster Thread thread = new Thread(CheckSystemSpecifications); thread.Start(); Thread idThread = new Thread(GenerateOnlineId); idThread.Start(); if (Directory.Exists(MainClientConstants.gamepath + "Updater")) { Logger.Log("Attempting to delete temporary updater directory."); try { Directory.Delete(MainClientConstants.gamepath + "Updater", true); } catch { } } if (ClientConfiguration.Instance.CreateSavedGamesDirectory) { if (!Directory.Exists(MainClientConstants.gamepath + "Saved Games")) { Logger.Log("Saved Games directory does not exist - attempting to create one."); try { Directory.CreateDirectory(MainClientConstants.gamepath + "Saved Games"); } catch { } } } if (CUpdater.CustomComponents != null) { Logger.Log("Removing partial custom component downloads."); foreach (CustomComponent component in CUpdater.CustomComponents) { try { File.Delete(MainClientConstants.gamepath + component.LocalPath + "_u"); } catch { } } } FinalSunSettings.WriteFinalSunIni(); WriteInstallPathToRegistry(); ClientConfiguration.Instance.RefreshSettings(); GameClass gameClass = new GameClass(); gameClass.Run(); }
private void InitUpdater() { CUpdater.CheckLocalFileVersions(); }
private void ForceUpdateMsgBox_YesClicked(XNAMessageBox obj) { CUpdater.ClearVersionInfo(); OnForceUpdate?.Invoke(this, EventArgs.Empty); }
/// <summary> /// The main method for startup and initialization. /// </summary> public void Execute() { int themeId = UserINISettings.Instance.ClientTheme; if (themeId >= ClientConfiguration.Instance.ThemeCount || themeId < 0) { themeId = 0; UserINISettings.Instance.ClientTheme.Value = 0; } ProgramConstants.RESOURCES_DIR = "Resources\\" + ClientConfiguration.Instance.GetThemeInfoFromIndex(themeId)[1]; Logger.Log("Initializing updater."); File.Delete(ProgramConstants.GamePath + "version_u"); CUpdater.Initialize(ClientConfiguration.Instance.LocalGame); Logger.Log("Operating system: " + Environment.OSVersion.VersionString); Logger.Log("Selected OS profile: " + MainClientConstants.OSId.ToString()); // The query in CheckSystemSpecifications takes lots of time, // so we'll do it in a separate thread to make startup faster Thread thread = new Thread(CheckSystemSpecifications); thread.Start(); if (Directory.Exists(MainClientConstants.gamepath + "Updater")) { Logger.Log("Attempting to delete temporary updater directory."); try { Directory.Delete(MainClientConstants.gamepath + "Updater", true); } catch { } } if (CUpdater.CustomComponents != null) { Logger.Log("Removing partial custom component downloads."); foreach (CustomComponent component in CUpdater.CustomComponents) { try { File.Delete(MainClientConstants.gamepath + component.LocalPath + "_u"); } catch { } } } FinalSunSettings.WriteFinalSunIni(); WriteInstallPathToRegistry(); ClientConfiguration.Instance.RefreshSettings(); GameClass gameClass = new GameClass(); gameClass.Run(); }