From de8a590a5610ce23c85ecf0dc58dd04036d13d60 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 9 Feb 2015 20:49:43 +0000 Subject: WinGui: More aggressive check that the user is not trying to overwrite the source file. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6889 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'win/CS/HandBrakeWPF/ViewModels') diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 18f994026..0048fe9d6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1220,6 +1220,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); @@ -1524,6 +1531,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. -- cgit v1.2.3