From 39613ae76e39b5a8ddaae50aa5d5665796acc726 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 12 Mar 2016 16:19:53 +0000 Subject: WinGui: Add SHA1 Verification of the update downloads and don't start the installer if the hash check fails. --- win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels') diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 3176070d0..69df5a635 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1124,7 +1124,7 @@ namespace HandBrakeWPF.ViewModels public void DownloadUpdate() { this.UpdateMessage = "Preparing for Update ..."; - this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.DownloadComplete, this.DownloadProgress); + this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.updateInfo.ExpectedSHA1Hash, this.DownloadComplete, this.DownloadProgress); } /// @@ -1412,10 +1412,13 @@ namespace HandBrakeWPF.ViewModels private void DownloadComplete(DownloadStatus info) { this.UpdateAvailable = false; - this.UpdateMessage = info.WasSuccessful ? Resources.OptionsViewModel_UpdateDownloaded : Resources.OptionsViewModel_UpdateFailed; + this.UpdateMessage = info.WasSuccessful ? Resources.OptionsViewModel_UpdateDownloaded : info.Message; - Process.Start(Path.Combine(Path.GetTempPath(), "handbrake-setup.exe")); - Execute.OnUIThread(() => Application.Current.Shutdown()); + if (info.WasSuccessful) + { + Process.Start(Path.Combine(Path.GetTempPath(), "handbrake-setup.exe")); + Execute.OnUIThread(() => Application.Current.Shutdown()); + } } /// -- cgit v1.2.3