From 172c9f50a07de174b39c6df0a62f90231b797113 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 25 Oct 2014 17:12:03 +0000 Subject: 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 --- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs') 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); -- cgit v1.2.3