public void GetdataFromDictionary(Dictionary <string, string> dictOfCommandsArguments) // get data from dictionary { foreach (KeyValuePair <string, string> item in dictOfCommandsArguments) { if (item.Key.ToLower().Equals("--input")) { try { StoreCounts result = ProcessTextFile(item.Value); // used exception if the path of file is not correct. DisplayResults(result); } catch (FileNotFoundException) { Console.WriteLine("File path is not correct please give correct file path as a argument"); } } } }
public void DisplayResults(StoreCounts result) // displaying the computed result { Console.WriteLine("Lines count of text file is : " + result.countOfLines); Console.WriteLine("Words count of text file is : " + result.countOfWords); Console.WriteLine("Characters count of text file is : " + result.countOfCharacters); }