Source

Resharper Spell Checker / ReSpeller / SpellEngine / Dictionaries / UserInternalDictionary.cs

using System.Collections.Generic;
using System.IO;

namespace ReSpeller.SpellEngine.Dictionaries
{
  
  public class UserInternalDictionary : IUserInternalDictionary
  {
    private readonly IDictionaryEngine myEngine;
    private readonly string myLanguage;
    private readonly IDictionaryStorage myUserStorage;
    private readonly IDictionaryStorage myInternalStorage;


    public UserInternalDictionary(IDictionaryEngine engine, string language, IDictionaryStorage userStorage, IDictionaryStorage internalStorage)
    {
      myEngine = engine;
      myLanguage = language;
      myUserStorage = userStorage;
      myInternalStorage = internalStorage;
      myEngine.AddRange(myUserStorage.GetContent());    
      myEngine.AddRange(myInternalStorage.GetContent());
    }

    public void Dispose()
    {
      myEngine.Dispose();
    }

    public string Language { get { return myLanguage; } }

    public IDictionaryEngine Engine { get { return myEngine; } }

    public bool Check(string word)
    {
      return myEngine.Check(word);
    }

    public List<string> Suggests(string word)
    {
      return myEngine.Suggest(word);
    }

    public void AddToUserDict(string word)
    {
      myUserStorage.AddWord(word);
      myEngine.Add(word);
    }

    public void AddToInternalDict(string word)
    {
      myInternalStorage.AddWord(word);
      myEngine.Add(word);
    }
  }
}