public void SplitWordToBooks() { var allWords = _fileManager.GetWordList(Constants.Book.AllWordFilePath); var word0 = allWords.Where(x => x.Difficulty == 0 && !x.IsFamiliar).Select(x => x).ToList(); var word1 = allWords.Where(x => x.Difficulty == 1 && !x.IsFamiliar).Select(x => x).ToList(); var word2 = allWords.Where(x => x.Difficulty == 2 && !x.IsFamiliar).Select(x => x).ToList(); var word3 = allWords.Where(x => x.Difficulty == 3 && !x.IsFamiliar).Select(x => x).ToList(); var word4 = allWords.Where(x => x.Difficulty == 4 && !x.IsFamiliar).Select(x => x).ToList(); var word5 = allWords.Where(x => x.Difficulty == 5 && !x.IsFamiliar).Select(x => x).ToList(); var familiarWord = allWords.Where(x => x.IsFamiliar).Select(x => x).ToList(); _fileManager.DeleteAllFilesInFolder(new DirectoryInfo(Constants.Book.BookPath)); var word0Books = _wordsManager.SplitWordToBooks(word0, "0"); var word1Books = _wordsManager.SplitWordToBooks(word1, "1"); var word2Books = _wordsManager.SplitWordToBooks(word2, "2"); var word3Books = _wordsManager.SplitWordToBooks(word3, "3"); var word4Books = _wordsManager.SplitWordToBooks(word4, "4"); var word5Books = _wordsManager.SplitWordToBooks(word5, "5"); var familiarBook = _wordsManager.SplitWordToBooks(familiarWord, "familiar"); _fileManager.SaveBook(word0Books); _fileManager.SaveBook(word1Books); _fileManager.SaveBook(word2Books); _fileManager.SaveBook(word3Books); _fileManager.SaveBook(word4Books); _fileManager.SaveBook(word5Books); _fileManager.SaveBook(familiarBook); }
public void SplitWordToBooks() { var allWords = _fileManager.GetWordList(Constants.Book.AllWordFilePath); var word10 = allWords.Where(x => x.Count <= 10).Select(x => x).ToList(); var word20 = allWords.Where(x => x.Count <= 20 && x.Count > 10).Select(x => x).ToList(); var word30 = allWords.Where(x => x.Count <= 30 && x.Count > 20).ToList(); var word40 = allWords.Where(x => x.Count <= 40 && x.Count > 30).Select(x => x).ToList(); var word50 = allWords.Where(x => x.Count > 40).Select(x => x).ToList(); _fileManager.DeleteAllFilesInFolder(new DirectoryInfo(Constants.Book.BookPath)); var word10Books = _wordsManager.SplitWordToBooks(word10, "10"); var word20Books = _wordsManager.SplitWordToBooks(word20, "20"); var word30Books = _wordsManager.SplitWordToBooks(word30, "30"); var word40Books = _wordsManager.SplitWordToBooks(word40, "40"); var word50Books = _wordsManager.SplitWordToBooks(word50, "50"); _fileManager.SaveBook(word10Books); _fileManager.SaveBook(word20Books); _fileManager.SaveBook(word30Books); _fileManager.SaveBook(word40Books); _fileManager.SaveBook(word50Books); }