From 5ff5a3c11adab950fe8a7cdea0e1441bcbf7f5b9 Mon Sep 17 00:00:00 2001 From: Ivandro Ismael Date: Sun, 4 Sep 2016 21:17:07 +0100 Subject: [PATCH 1/2] [Compare] - Move get filter to contructor. --- src/Forms/Compare.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Forms/Compare.cs b/src/Forms/Compare.cs index 812cdcf15..1b0403d08 100644 --- a/src/Forms/Compare.cs +++ b/src/Forms/Compare.cs @@ -43,6 +43,7 @@ namespace Nikse.SubtitleEdit.Forms UiUtil.FixLargeFonts(this, buttonOK); subtitleListView1.UseSyntaxColoring = false; subtitleListView2.UseSyntaxColoring = false; + openFileDialog1.Filter = Utilities.GetOpenDialogFilter(); } public void Initialize(Subtitle subtitle1, string subtitleFileName1, string title) @@ -65,8 +66,6 @@ namespace Nikse.SubtitleEdit.Forms { } } - - openFileDialog1.Filter = Utilities.GetOpenDialogFilter(); subtitleListView1.SelectIndexAndEnsureVisible(0); _language1 = LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle1); } @@ -86,7 +85,6 @@ namespace Nikse.SubtitleEdit.Forms if (!string.IsNullOrEmpty(subtitleFileName1) && File.Exists(subtitleFileName1)) openFileDialog1.InitialDirectory = Path.GetDirectoryName(subtitleFileName1); - openFileDialog1.Filter = Utilities.GetOpenDialogFilter(); subtitleListView1.SelectIndexAndEnsureVisible(0); subtitleListView2.SelectIndexAndEnsureVisible(0); } From a4c2da46e5d1daeb672b0a4b5972f1bb00ba31fa Mon Sep 17 00:00:00 2001 From: Ivandro Ismael Date: Sun, 4 Sep 2016 22:09:48 +0100 Subject: [PATCH 2/2] [Compare] - Return if directory is dropped. --- src/Forms/Compare.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Forms/Compare.cs b/src/Forms/Compare.cs index 1b0403d08..4cfd98c15 100644 --- a/src/Forms/Compare.cs +++ b/src/Forms/Compare.cs @@ -855,8 +855,14 @@ namespace Nikse.SubtitleEdit.Forms string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - string filePath = files[0]; + if (FileUtil.IsDirectory(filePath)) + { + MessageBox.Show(Configuration.Settings.Language.Main.ErrorDirectoryDropNotAllowed, + string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + var listExt = new List(); foreach (var s in Utilities.GetOpenDialogFilter().Split(new[] { '*' }, StringSplitOptions.RemoveEmptyEntries)) {