WinGui: More aggressive check that the user is not trying to overwrite the source...
authorsr55 <sr55.hb@outlook.com>
Mon, 9 Feb 2015 20:49:43 +0000 (20:49 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 9 Feb 2015 20:49:43 +0000 (20:49 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6889 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
win/CS/HandBrakeWPF/Properties/Resources.resx
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs

index 5770105f6f339edce0981532500b55fd29d08f99..230a8d42c0594780084bbd97dc6ec3682314dd7e 100644 (file)
@@ -693,6 +693,16 @@ namespace HandBrakeWPF.Properties {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to You cannot overwrite the source file you want to convert.\r
+        ///Please choose a different filename..\r
+        /// </summary>\r
+        public static string Main_SourceDestinationMatchError {\r
+            get {\r
+                return ResourceManager.GetString("Main_SourceDestinationMatchError", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   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..\r
         /// </summary>\r
index b21a76e813240864f7ebd26e78a050e27a238d72..a5e9e3878aa61e6a6b8fbb3cebf10ab14b07a584 100644 (file)
@@ -552,4 +552,8 @@ Please use the 'Extra Options' box on the 'Video' tab to input any additional en
   <data name="Video_EncoderExtraArgsTooltip" xml:space="preserve">\r
     <value>Additional advanced arguments that can be passed to the video encoder.</value>\r
   </data>\r
+  <data name="Main_SourceDestinationMatchError" xml:space="preserve">\r
+    <value>You cannot overwrite the source file you want to convert.\r
+Please choose a different filename.</value>\r
+  </data>\r
 </root>
\ No newline at end of file
index 18f99402679dd13b6a6f92800d33ab0461840aa9..0048fe9d65ddaf9186b41f823695eeed71209032 100644 (file)
@@ -1220,6 +1220,13 @@ namespace HandBrakeWPF.ViewModels
                 return false;\r
             }\r
 \r
+            if (this.Destination == this.ScannedSource.ScanPath)\r
+            {\r
+                this.errorService.ShowMessageBox(Resources.Main_SourceDestinationMatchError, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
+                this.Destination = null;\r
+                return false;\r
+            }\r
+\r
             if (this.scannedSource != null && !string.IsNullOrEmpty(this.scannedSource.ScanPath) && this.Destination.ToLower() == this.scannedSource.ScanPath.ToLower())\r
             {\r
                 this.errorService.ShowMessageBox(Resources.Main_MatchingFileOverwriteWarning, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
@@ -1524,6 +1531,13 @@ namespace HandBrakeWPF.ViewModels
             bool? result = saveFileDialog.ShowDialog();\r
             if (result.HasValue && result.Value)\r
             {\r
+                if (saveFileDialog.FileName == this.ScannedSource.ScanPath)\r
+                {\r
+                    this.errorService.ShowMessageBox(Resources.Main_SourceDestinationMatchError, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
+                    this.Destination = null;\r
+                    return;\r
+                }\r
+\r
                 this.Destination = saveFileDialog.FileName;\r
 \r
                 // Set the Extension Dropdown. This will also set Mp4/m4v correctly.\r