public bool DownloadLatestVersion() { var downloadedAndExtracted = NetworkOperations.DownloadLatestVersion(this.GameRootDirectory); if (downloadedAndExtracted) { this.LoadModVersion(); return(true); } return(false); }
private void CheckUpdateButton_Click(object sender, EventArgs e) { if (!FileOperations.IsValidAmongUsDirectory(this.Manager.GameRootDirectory)) { MessageBox.Show("You have to select the Among Us directory before checking for a new update.", "Error"); return; } this.SetStatus("Checking for update"); var newVersionAvailable = this.Manager.CheckForNewVersion(); this.SetStatus(""); if (newVersionAvailable) { DialogResult _Result = MessageBox.Show($"Found a new version: {NetworkOperations.GetLatestVersion()} - Do you want to install it?", "New Version available", MessageBoxButtons.YesNoCancel); if (_Result == DialogResult.Yes) { this.SetStatus("Downloading and Extracting Mod Files"); var succesfully = this.Manager.DownloadLatestVersion(); this.SetStatus(""); if (succesfully && this.Manager.ModFileLoaded) { this.DeleteModButton.Enabled = true; this.CurrentVersionLabel.Text = $"Installed ExtraRoles Mod Version: {(this.Manager.ModVersion == "" ? "None" : this.Manager.ModVersion)}"; MessageBox.Show($"ExtraRoles Mod Version: {this.Manager.ModVersion} was installed succesfully.", "Installation was succesful"); } else { MessageBox.Show($"ExtraRoles Mod Version: {this.Manager.ModVersion} could not be installed. Please try again.", "Error"); } } } else { MessageBox.Show($"Your installed ExtraRoles Mod version ({this.Manager.ModVersion}) is up to date.", "Up to date"); } }
public bool CheckForNewVersion() { return(NetworkOperations.IsNewVersionAvailable(this.ModVersion)); }