diff options
author | sr55 <[email protected]> | 2014-10-25 17:12:03 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-10-25 17:12:03 +0000 |
commit | 172c9f50a07de174b39c6df0a62f90231b797113 (patch) | |
tree | 889728c232a0980e60daf8407ec05b0ce60443e5 /win/CS | |
parent | e9bfb09167b3ecfcf8c1bbb652a4d3da54d45243 (diff) |
WinGui: Block users from attempting to overwrite their input file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6465 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.Designer.cs | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.resx | 3 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 12 |
3 files changed, 24 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 3cc320e5e..7f787b97f 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -428,6 +428,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to You cannot encode to a file with the same path and name as the source file. Please update the destination filename so that it does not match the source file..
+ /// </summary>
+ public static string Main_MatchingFileOverwriteWarning {
+ get {
+ return ResourceManager.GetString("Main_MatchingFileOverwriteWarning", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to New Default Preset Set: {0}.
/// </summary>
public static string Main_NewDefaultPreset {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index ae889dd63..9a406c92c 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -527,4 +527,7 @@ Non-Live Options: {date} {time} {quality} {bitrate} (These only change if you s Not both at the same time!</value>
</data>
+ <data name="Main_MatchingFileOverwriteWarning" xml:space="preserve">
+ <value>You cannot encode to a file with the same path and name as the source file. Please update the destination filename so that it does not match the source file.</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 2bd91de96..81558c78d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1212,6 +1212,12 @@ namespace HandBrakeWPF.ViewModels 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);
+ return false;
+ }
+
QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))
@@ -1370,6 +1376,12 @@ namespace HandBrakeWPF.ViewModels return;
}
+ 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);
+ return;
+ }
+
if (File.Exists(this.Destination))
{
MessageBoxResult result = this.errorService.ShowMessageBox(Resources.Main_DestinationOverwrite, Resources.Question, MessageBoxButton.YesNo, MessageBoxImage.Question);
|