Exemple #1
0
        private static void ExecuteScrambledWordsManualEntryScenario()
        {
            string userInput = Console.ReadLine();

            WordMatcher matcher          = new WordMatcher();
            var         thisExeDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string      filePath         = Path.Combine(thisExeDirectory, "wordlist.txt");

            if (!File.Exists(filePath))
            {
                Console.WriteLine("File does not exist");
                return;
            }


            FileReader reader = new FileReader();

            string[] arrStrings = reader.Read(filePath);

            if (arrStrings.Length == 0)

            {
                Console.WriteLine("File is empty");
                return;
            }

            string[] scrambledWords = userInput.Split(',');


            List <MatchedWord> matchedWords = matcher.Match(scrambledWords, arrStrings);

            foreach (MatchedWord word in matchedWords)
            {
                Console.WriteLine(word.ScrambledWord + " = " + word.Word);
            }

            // 3 Call the DisplayMatchedUnscrambledWords method passing the scrambled words string array
        }