コード例 #1
0
ファイル: Program.cs プロジェクト: ralbu/wordstest
        private static void RunPart1()
        {
            string fileLocation = GetFileLocation("part1fileinput.txt");

            var fileLoader = new FileWordsLoader(fileLocation);
            var wordsCounter = new WordsCounter(fileLoader);

            try
            {
                PrintPart1(wordsCounter.Count());
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File was not found at location: {0}", fileLocation);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ralbu/wordstest
        private static void RunPart2()
        {
            string fileLocation = GetFileLocation("part2fileinput.txt");

            var fileLoader = new FileWordsLoader(fileLocation);
            var wordsFilter = new WordsFilter(fileLoader);
            List<string> filteredWords = null;
            try
            {
                filteredWords = wordsFilter.Filter();
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File was not found at location: {0}", fileLocation);
            }

            foreach (var word in filteredWords)
            {
                Console.WriteLine(word);
            }
        }