示例#1
0
        private void SaveNewTranslate(string word)
        {
            if (word != string.Empty)
            {
                _dictionary.Add(_newWord, word);
                _isChanged = true;
                Console.WriteLine(@"Слово “{0}” сохранено в словаре как “{1}”.", _newWord, word);
            }
            else
            {
                Console.WriteLine(@"Слово “{0}” проигнорировано.", _newWord);
            }

            _unknownWord = false;
        }
        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);
        }