private static SpellEngine RawGetSpellChecker(string dictId) { SpellEngine result = null; var rootDir = GetSpellingDirectoryPath(); var dictPath = GetShortName(Path.Combine(rootDir, Path.ChangeExtension(dictId, "dic"))); var affixPath = GetShortName(Path.Combine(rootDir, Path.ChangeExtension(dictId, "aff"))); var exceptionPath = GetExceptionFileName(dictPath); if (File.Exists(dictPath) && File.Exists(affixPath)) { try { result = new SpellEngine(affixPath, dictPath, exceptionPath); } catch (Exception) { if (result != null) { result.Dispose(); } throw; } } // Enhance JohnT: may want to look in OO and/or Firefox directory. return(result); }
internal static SpellEngine Create(string affixPath, string dictPath, string exceptionPath) { SpellEngine spellEngine = null; try { if (Platform.IsWindows) { spellEngine = CreateSpellEngineWindows(affixPath, dictPath, exceptionPath); } else { spellEngine = CreateSpellEngineLinux(affixPath, dictPath, exceptionPath); } spellEngine.Initialize(); } catch (Exception e) { Debug.WriteLine("Initializing Hunspell: {0} exception: {1} ", e.GetType(), e.Message); spellEngine?.Dispose(); throw; } return(spellEngine); }