From: sr55 Date: Mon, 9 Feb 2015 20:50:34 +0000 (+0000) Subject: [Merge] WinGui: More aggressive check that the user is not trying to overwrite the... X-Git-Tag: 0.10.1~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c4f35e7a067f5b50cfbf0c3263a76da0c356e5c;p=handbrake [Merge] WinGui: More aggressive check that the user is not trying to overwrite the source file. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@6890 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index ed1ad8c8e..8b33917e5 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -681,6 +681,16 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to You cannot overwrite the source file you want to convert. + ///Please choose a different filename.. + /// + public static string Main_SourceDestinationMatchError { + get { + return ResourceManager.GetString("Main_SourceDestinationMatchError", resourceCulture); + } + } + /// /// Looks up a localized string similar to You must turn on automatic file naming AND set a default path in preferences before you can add to the queue.. /// diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 4e26dc46f..7577dc4bd 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -543,4 +543,8 @@ Not both at the same time! The preset may be corrupted or from an older version of HandBrake which is not supported. Presets from older versions must be re-created in the current version. + + You cannot overwrite the source file you want to convert. +Please choose a different filename. + \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 3665c7acf..ce9f9a04b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1219,6 +1219,13 @@ namespace HandBrakeWPF.ViewModels return false; } + if (this.Destination == this.ScannedSource.ScanPath) + { + this.errorService.ShowMessageBox(Resources.Main_SourceDestinationMatchError, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); + this.Destination = null; + return false; + } + if (this.scannedSource != null && !string.IsNullOrEmpty(this.scannedSource.ScanPath) && this.Destination.ToLower() == this.scannedSource.ScanPath.ToLower()) { this.errorService.ShowMessageBox(Resources.Main_MatchingFileOverwriteWarning, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); @@ -1535,6 +1542,13 @@ namespace HandBrakeWPF.ViewModels bool? result = saveFileDialog.ShowDialog(); if (result.HasValue && result.Value) { + if (saveFileDialog.FileName == this.ScannedSource.ScanPath) + { + this.errorService.ShowMessageBox(Resources.Main_SourceDestinationMatchError, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); + this.Destination = null; + return; + } + this.Destination = saveFileDialog.FileName; // Set the Extension Dropdown. This will also set Mp4/m4v correctly.