Exemplo n.º 1
0
        public void RemoveEntry_ensures_a_word_is_no_longer_returned_as_a_suggestion()
        {
            const string root = "peo";

            ConfigureProvider();

            autoComplete.RemoveEntry("people");

            // "peo" is not a word, so the list will either be 0 or 1 long, as we've not populated any other words
            // beginning with those letters.
            ExpectEmpty(root);
        }
        public void RemoveEntryFromDictionary(string entry)
        {
            Log.DebugFormat("RemoveEntryFromDictionary called with entry '{0}'", entry);

            if (entries != null &&
                !string.IsNullOrWhiteSpace(entry) &&
                ExistsInDictionary(entry))
            {
                var hash = entry.CreateDictionaryEntryHash(log: false);
                if (!string.IsNullOrWhiteSpace(hash) &&
                    entries.ContainsKey(hash))
                {
                    var foundEntry = entries[hash].FirstOrDefault(ewuc => ewuc.Entry == entry);

                    if (foundEntry != null)
                    {
                        Log.DebugFormat("Removing entry '{0}' from dictionary", entry);

                        entries[hash].Remove(foundEntry);

                        if (!entries[hash].Any())
                        {
                            entries.Remove(hash);
                        }

                        //Also remove from entries for auto complete
                        manageAutoComplete.RemoveEntry(entry);

                        SaveUserDictionaryToFile();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void RemoveEntryFromDictionary(string entry)
        {
            Log.DebugFormat("RemoveEntryFromDictionary called with entry '{0}'", entry);

            if (entries != null &&
                !string.IsNullOrWhiteSpace(entry) &&
                ExistsInDictionary(entry))
            {
                var hash = entry.NormaliseAndRemoveRepeatingCharactersAndHandlePhrases(log: false);
                if (!string.IsNullOrWhiteSpace(hash) &&
                    entries.ContainsKey(hash))
                {
                    var foundEntry = entries[hash].FirstOrDefault(ewuc => ewuc.Entry == entry);

                    if (foundEntry != null)
                    {
                        Log.DebugFormat("Removing entry '{0}' from dictionary", entry);

                        //Also remove from entries for auto complete
                        manageAutoComplete.RemoveEntry(entry);

                        SaveUserDictionaryToFile();
                    }
                }
            }
        }