Пример #1
0
        static void SortList(string[] args)
        {
            GuardClauses.NoSelectedList(args);
            var loadedList = WordList.LoadList(args[1]);

            GuardClauses.LoadedListReturnsNull(loadedList, args[1]);
            GuardClauses.SelectedListDoesntContainWords(loadedList);

            if (args.Length < 3)
            {
                loadedList.List(0, ShowTranslation);
            }
            else
            {
                GuardClauses.SelectedListDoesntContainLanguage(loadedList, args[2]);
                string language = args[2];
                int    index    = Array.FindIndex(loadedList.Languages, l => l.Contains(language));
                loadedList.List(index, ShowTranslation);
            }
        }
Пример #2
0
        static void PracticeWords(string[] args)
        {
            GuardClauses.NoSelectedList(args);
            var loadedList = WordList.LoadList(args[1]);

            GuardClauses.LoadedListReturnsNull(loadedList, args[1]);
            GuardClauses.SelectedListDoesntContainWords(loadedList);
            PracticeConsole.ResetPractice();
            while (true)
            {
                Word            randomWord   = loadedList.GetWordToPractice();
                PracticeConsole practiceMode = new PracticeConsole(randomWord, loadedList);
                practiceMode.Play();

                string userInput = Console.ReadLine();
                if (userInput == "")
                {
                    practiceMode.PrintTotalScore();
                    break;
                }
                practiceMode.PrintRightOrWrong(userInput);
            }
        }