From 4917de0c4bbf5120845b898bdbd79f52536a707e Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Tue, 11 Jun 2024 22:46:30 +0100 Subject: [PATCH] Remove spell check functionality from FixCommonErrors The `IFixCallbacks` interface no longer inherits from `IDoSpell` as it is unnecessary. This is due to the removal of the `DoSpell` method and the associated Hunspell functionality in the `FixCommonErrors` class. This commit simplifies the code by removing unused or unnecessary pieces. Signed-off-by: Ivandro Jao --- src/libse/Interfaces/IFixCallbacks.cs | 2 +- src/ui/Forms/FixCommonErrors.cs | 29 --------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/libse/Interfaces/IFixCallbacks.cs b/src/libse/Interfaces/IFixCallbacks.cs index 4c474043e..dda6aa575 100644 --- a/src/libse/Interfaces/IFixCallbacks.cs +++ b/src/libse/Interfaces/IFixCallbacks.cs @@ -5,7 +5,7 @@ using System.Text; namespace Nikse.SubtitleEdit.Core.Interfaces { - public interface IFixCallbacks : IDoSpell + public interface IFixCallbacks { bool AllowFix(Paragraph p, string action); void AddFixToListView(Paragraph p, string action, string before, string after); diff --git a/src/ui/Forms/FixCommonErrors.cs b/src/ui/Forms/FixCommonErrors.cs index 65d35f812..391532591 100644 --- a/src/ui/Forms/FixCommonErrors.cs +++ b/src/ui/Forms/FixCommonErrors.cs @@ -1899,35 +1899,6 @@ namespace Nikse.SubtitleEdit.Forms } } - private Hunspell _hunspell; - - public bool DoSpell(string word) - { - if (_hunspell == null && Language != null) - { - var fileMatches = Directory.GetFiles(Utilities.DictionaryFolder, Language + "*.dic"); - if (fileMatches.Length > 0) - { - var dictionary = fileMatches[0].Substring(0, fileMatches[0].Length - 4); - try - { - _hunspell = Hunspell.GetHunspell(dictionary); - } - catch - { - _hunspell = null; - } - } - } - - if (_hunspell == null) - { - return false; - } - - return _hunspell.Spell(word); - } - private void toolStripMenuItemSelectAll_Click(object sender, EventArgs e) { listViewFixes.CheckAll();