private void AddToSensitiveList(
            BlockCommandContext context,
            string word)
        {
            // Update the internal dictionaries by removing it from the
            // insensitive list and adding it to the sensitive list.
            CaseInsensitiveDictionary.Remove(word.ToLowerInvariant());
            CaseSensitiveDictionary.Add(word);

            // Clear the spell-checking on the entire document and reparse it.
            Project.Plugins.ClearAnalysis(BlockAnalyzer);
            Project.Plugins.ProcessBlockAnalysis();

            // Make sure the settings are written out.
            WriteSettings();
        }
        public WordCorrectness IsCorrect(string word)
        {
            // First check the case-sensitive dictionary.
            bool isCaseSensitiveCorrect = CaseSensitiveDictionary.Contains(word);

            if (isCaseSensitiveCorrect)
            {
                return(WordCorrectness.Correct);
            }

            // Check the case-insensitive version by making it lowercase and trying
            // again.
            word = word.ToLowerInvariant();

            bool isCaseInsensitiveCorrect = CaseInsensitiveDictionary.Contains(word);

            // The return value is either correct or indeterminate since this
            // plugin is intended to be a supplemental spell-checking instead of
            // a conclusive one.
            return(isCaseInsensitiveCorrect
                                ? WordCorrectness.Correct
                                : WordCorrectness.Indeterminate);
        }
        /// <summary>
        /// Retrieves the setting substitutions and rebuilds the internal list.
        /// </summary>
        public void ReadSettings()
        {
            // Clear out the existing settings.
            CaseInsensitiveDictionary.Clear();
            CaseSensitiveDictionary.Clear();

            // Go through all of the settings in the various projects.
            IList <LocalWordsSettings> settingsList =
                Project.Settings.GetAll <LocalWordsSettings>(LocalWordsSettings.SettingsPath);

            foreach (LocalWordsSettings settings in settingsList)
            {
                // Add the two dictionaries.
                foreach (string word in settings.CaseInsensitiveDictionary)
                {
                    CaseInsensitiveDictionary.Add(word);
                }

                foreach (string word in settings.CaseSensitiveDictionary)
                {
                    CaseSensitiveDictionary.Add(word);
                }
            }
        }