]> granicus.if.org Git - handbrake/commitdiff
[Merge] WinGui: More aggressive check that the user is not trying to overwrite the...
authorsr55 <sr55.hb@outlook.com>
Mon, 9 Feb 2015 20:50:34 +0000 (20:50 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 9 Feb 2015 20:50:34 +0000 (20:50 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@6890 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 ed1ad8c8e38b7fe1133910bf37e1ca67945818c0..8b33917e56584c2021f1723e6a1e8102c32b8a43 100644 (file)
@@ -681,6 +681,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 4e26dc46f699b5cf39c9730138818fc23d8ee2ce..7577dc4bd04cc92253d77cdaa71c9c3ab2468aa1 100644 (file)
@@ -543,4 +543,8 @@ Not both at the same time!</value>
     <value>The preset may be corrupted or from an older version of HandBrake which is not supported. \r
 Presets from older versions must be re-created in the current version.</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 3665c7acf6f306210ece872b09c1425ab8c442a8..ce9f9a04b9c6e4d0dc6485499877d5e6ea4ace51 100644 (file)
@@ -1219,6 +1219,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
@@ -1535,6 +1542,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