public void CheckSpelling(string content)
        {
            if (box.IsSpellCheckEnabled)
            {
                ClearLists();

                var matches = Regex.Matches(content, @"\w+[^\s]*\w+|\w");

                foreach (Match match in matches)
                {
                    Words.Add(new Word(match.Value.Trim(), match.Index));
                }

                foreach (var word in Words)
                {
                    bool isIgnored = IgnoredWords.Contains(word);
                    if (!isIgnored)
                    {
                        bool exists = hunSpell.Spell(word.Text);
                        if (exists)
                        {
                            IgnoredWords.Add(word);
                        }
                        else
                        {
                            MisspelledWords.Add(word);
                        }
                    }
                }

                OnPropertyChanged("MisspelledWords");
                OnPropertyChanged("IgnoredWords");
            }
        }
Exemple #2
0
        public static void SaveIgnoredWords()
        {
            IgnoredWords = IgnoredWords.OrderBy(p => p).ToList();
            var strb = new StringBuilder();

            foreach (var word in IgnoredWords)
            {
                strb.AppendFormat("{0}\n", word);
            }
            var path = getPathToIgnoredWordsFile();

            File.WriteAllText(path, strb.ToString());
        }
 public void AddIgnoreWords(Word word)
 {
     IgnoredWords.Add(word);
 }
 public void SaveToCustomDictionary(Word word)
 {
     File.AppendAllText(box.CustomDictionaryPath, string.Format("{0}{1}", word.Text.ToLower(), Environment.NewLine));
     hunSpell.Add(word.Text);
     IgnoredWords.Add(word);
 }