public void WriteData(MiniDictionary dictionary)
 {
     using (StreamWriter sr = new StreamWriter(File.OpenWrite(_path)))
     {
         foreach (KeyValuePair <string, string> word in dictionary._dictionaryWords)
         {
             sr.WriteLine(@"{0}-{1}", word.Key, word.Value);
         }
     }
 }
        public MiniDictionary GetData()
        {
            MiniDictionary dictionary = new MiniDictionary();

            if (File.Exists(_path))
            {
                using (StreamReader sr = File.OpenText(_path))
                {
                    while (!sr.EndOfStream)
                    {
                        string[] words = sr.ReadLine().Split('-');
                        dictionary.Add(words[WordIndex], words[TranslateIndex]);
                    }
                }
            }

            return(dictionary);
        }
Esempio n. 3
0
 public void DictionaryInit()
 {
     _dictionary = dataProvider.GetData();
 }