Exemplo n.º 1
0
 /// <summary>
 /// Configures the custom dictionary settings.
 /// </summary>
 /// <param name="dictionary"></param>
 protected virtual void SetupCustomDictionary(SpellCheckerCustomDictionary dictionary)
 {
     dictionary.Encoding = System.Text.Encoding.UTF8;
     dictionary.Culture  = SpellChecker.Culture;
     if (SpellCheckerOptions.PathResolutionMode == FilePathResolutionMode.None)
     {
         SpellCheckerDictionaryStreamInfo streamInfo = GetDictionaryStreamInfo(true);
         try {
             dictionary.Load(streamInfo.DictionaryStream, streamInfo.AlphabetStream);
         }
         finally {
             if (streamInfo.AlphabetStream != null)
             {
                 streamInfo.AlphabetStream.Dispose();
                 streamInfo.AlphabetStream = null;
             }
             if (streamInfo.DictionaryStream != null)
             {
                 streamInfo.DictionaryStream.Dispose();
                 streamInfo.DictionaryStream = null;
             }
         }
     }
     else
     {
         SpellCheckerDictionaryFileInfo fileInfo = GetDictionaryFileInfo(true);
         dictionary.AlphabetPath   = fileInfo.AlphabetPath;
         dictionary.DictionaryPath = fileInfo.DictionaryPath;
     }
 }
        static SpellCheckerDictionaryBase GetCustomDictionary(string path, string _culture)
        {
            CultureInfo cInfo = new CultureInfo(_culture);
            SpellCheckerCustomDictionary custom_dict = new SpellCheckerCustomDictionary(String.Format("{0}\\{1}-custom.dic", path, _culture), cInfo);

            custom_dict.Encoding = System.Text.Encoding.GetEncoding(cInfo.TextInfo.ANSICodePage);
            custom_dict.Load();
            return(custom_dict);
        }
Exemplo n.º 3
0
        static ISpellCheckerDictionary GetCustomDictionary()
        {
            SpellCheckerCustomDictionary result = new SpellCheckerCustomDictionary();
            Stream dictionaryStream             = DemoUtils.GetDataStream(DemoUtils.PathToDictionaries, "CustomEnglish.dic");
            Stream alphabetStream = DemoUtils.GetDataStream(DemoUtils.PathToDictionaries, "EnglishAlphabet.txt");

            try {
                result.Load(dictionaryStream, alphabetStream);
            }
            catch {
            }
            finally {
                dictionaryStream.Close();
                alphabetStream.Close();
            }
            result.Culture = new CultureInfo("en-US");
            return(result);
        }