コード例 #1
0
ファイル: HomeController.cs プロジェクト: YasikYa/BookHelper
        private List <WordInfo> ConvertToWordInfo(IEnumerable <KeyValuePair <string, int> > wordsCount)
        {
            LearnWord kostyl;

            LearnedWordXmlSource source =
                new LearnedWordXmlSource(ServerPath.MapUserVocabularyPath(User.Identity.Name));
            List <WordInfo> wordsInfo = new List <WordInfo>(wordsCount.Count());

            foreach (var pair in wordsCount)
            {
                WordInfo word = new WordInfo {
                    WordString = pair.Key, Count = pair.Value
                };

                if (source.IsLearned(pair.Key, out kostyl))
                {
                    word.Status = WordStatus.Learned;
                }
                else
                {
                    word.Status = WordStatus.NotLearned;
                }

                wordsInfo.Add(word);
            }
            return(wordsInfo);
        }
コード例 #2
0
        private void CreateVocabulary(string userName)
        {
            string path = MyVocabulary.Useful.ServerPath.MapUserVocabularyPath(userName);

            LearnedWordXmlSource vocabulary = new LearnedWordXmlSource(path);

            vocabulary.Save();
        }