コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void DictionaryInit()
 {
     _dictionary = dataProvider.GetData();
 }