public void InstallUpdates() { try { string downloadFile = Path.Combine(this.downloadUrl, $"{this.msiFile}{this.msiExstention}"); string saveVersionFile = Path.Combine(Paths.KnownFolder(KnownFolders.KnownFolder.Downloads), $"{this.msiFile}.{VersionManager.ServerVersion}{this.msiExstention}"); using (DownloadWebClient client = new DownloadWebClient()) { client.DownloadFile(downloadFile, saveVersionFile); } Process.Start(saveVersionFile); } catch (Exception err) { throw; } }
public bool HaveUpdates(string thisVersion) { try { CheckForUpdatesFailed = false; string downloadFile = Path.Combine(this.downloadUrl, this.versionFile); string saveVersionFile = Path.Combine(Paths.KnownFolder(KnownFolders.KnownFolder.Downloads), this.versionFile); using (DownloadWebClient client = new DownloadWebClient()) { client.DownloadFile(downloadFile, saveVersionFile); } VersionManager.ServerVersion = File.ReadAllText(saveVersionFile) .Replace("\n", string.Empty) .Replace("\r", string.Empty); File.Delete(saveVersionFile); if (!this.IsVersionNumber(VersionManager.ServerVersion)) { CheckForUpdatesFailed = true; VersionManager.ServerVersion = string.Empty; // We now need to notify the user that the system updates failed. return(true); } return(thisVersion != VersionManager.ServerVersion); } catch (Exception err) { return(false); } }