public static void Main() { List <Customer> customerList = new List <Customer>(); customerList.AddIntoCollection(CSVData.GetInstance().ReadDataFromFile(filePath + "customers.csv")); customerList.AddIntoCollection(XMLData.GetInstance().ReadDataFromFile(filePath + "customers.xml")); customerList.AddIntoCollection(JSONData.GetInstance().ReadDataFromFile(filePath + "customers.json")); if (customerList.Count > 0) { //Printing the count. Console.WriteLine("\n" + "Added this many customers: " + customerList.Count + "\n"); //Printing the records. StringCorrection.DisplayRecords(customerList); } }
static void Main(string[] arguments) { int y = Console.CursorLeft; int x = Console.CursorTop; bool shouldWork = true; while (shouldWork) { if (arguments.Length != 0) { StringCorrection stringCorrection = new StringCorrection(); for (int i = 0; i < arguments.Length; i++) { stringCorrection.SetString(arguments[i]); Console.Write("Original title: "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(arguments[i]); Console.ResetColor(); Console.Write("Capitalized title: "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(stringCorrection.Correction()); Console.ResetColor(); Console.WriteLine(); } shouldWork = false; } else { string stringForCorrection = null; bool askAgain = true; while (askAgain) { Console.Write("Enter title to capitalize: "); Console.ForegroundColor = ConsoleColor.Red; stringForCorrection = Console.ReadLine(); Console.ResetColor(); if (!string.IsNullOrEmpty(stringForCorrection)) { askAgain = false; } else { Console.SetCursorPosition(y, x); } } StringCorrection stringCorrection = new StringCorrection(stringForCorrection); Console.Write("Capitalized title: "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(stringCorrection.Correction()); Console.ResetColor(); Console.WriteLine(); y = Console.CursorLeft; x = Console.CursorTop; Console.SetCursorPosition(y, x); } } }