/// <summary> /// The application entry point. /// </summary> /// <param name="args"> /// The command line arguments. /// </param> static void Main(string[] args) { args = new String[2]; string inputProceedAnswer = string.Empty; string inputFilePath = string.Empty; string outputFilePath = string.Empty; string outputProceedAnswer = string.Empty; #region Input filepath while (String.IsNullOrEmpty(inputProceedAnswer) || inputProceedAnswer.ToLower() == "n") { Console.WriteLine("Please provide the full path of the chat text file you want to export: "); inputFilePath = Console.ReadLine(); while (String.IsNullOrEmpty(inputFilePath)) { Console.WriteLine("Please provide the full path of the chat text file you want to export:"); inputFilePath = Console.ReadLine(); } Console.WriteLine("You have selected the following filepath: '{0}'", inputFilePath); Console.WriteLine("Are you sure you this is the correct path? [Y/N]"); inputProceedAnswer = Console.ReadLine(); while (String.IsNullOrEmpty(inputProceedAnswer) || (inputProceedAnswer.ToLower() != "y" && inputProceedAnswer.ToLower() != "n")) { Console.WriteLine("Please type in 'Y' or 'N' to proceed."); inputProceedAnswer = Console.ReadLine(); } } args[0] = inputFilePath; #endregion #region Output filepath while (String.IsNullOrEmpty(outputProceedAnswer) || outputProceedAnswer.ToLower() == "n") { Console.WriteLine("Please provide the full path of the folder you want to export to: "); outputFilePath = Console.ReadLine(); while (String.IsNullOrEmpty(outputFilePath)) { Console.WriteLine("Please provide the full path of the folder you want to export to: "); outputFilePath = Console.ReadLine(); } Console.WriteLine("You have selected the following filepath: '{0}'", outputFilePath); Console.WriteLine("Are you sure you this is the correct path? [Y/N]"); outputProceedAnswer = Console.ReadLine(); while (String.IsNullOrEmpty(outputProceedAnswer) || (outputProceedAnswer.ToLower() != "y" && (outputProceedAnswer.ToLower() != "n"))) { Console.WriteLine("Please type in 'Y' or 'N' to proceed."); outputProceedAnswer = Console.ReadLine(); } } args[1] = outputFilePath; #endregion var conversationExporter = new ConversationExporter(); ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args); ExportResponse eResponse = conversationExporter.ExportConversation(configuration.inputFilePath, configuration.outputFilePath); if (!eResponse.Successful) Console.WriteLine(eResponse.Message); Console.ReadLine(); }
/// <summary> /// The application entry point. /// </summary> /// <param name="args"> /// The command line arguments. /// </param> static void Main(string[] args) { var conversationExporter = new ConversationExporter(); ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args); int choice = 0; do { StringBuilder blackListString = new StringBuilder(); if (configuration.wordsBlacklist != null) { blackListString.Append("["); foreach (string str in configuration.wordsBlacklist) { blackListString.Append(str + ","); } blackListString.Remove(blackListString.Length-1, 1); blackListString.Append("]"); } Console.WriteLine("What to do next?"); Console.WriteLine("1. --Filter By Username-- {0}\n2. --Filter By Keyword-- {1}\n3. --Hide Specific Words-- {2}\n4. --Obfuscate user IDs-- {3}\n5. Clear Filters\n6. Convert and Export", configuration.usernameFilter, configuration.keyword, blackListString.ToString(), configuration.obfuscateUserIDsFlag); //read user input string key = Console.ReadKey().Key.ToString(); Console.WriteLine(); switch (key) { case "D1": //filter by username { do { configuration.usernameFilter = conversationExporter.PromptUserForInput("Please give the username to filter with"); configuration.filtersActive = true; break; }while(true); break; } case "D2": //filter by keyword { configuration.keyword = conversationExporter.PromptUserForInput("Please give the keyword to filter with"); configuration.filtersActive = true; break; } case "D3"://hide keywords { StringBuilder input = new StringBuilder(); input.Append(conversationExporter.PromptUserForInput("Enter words to hide separated with comma(,): ")); input.Replace(" ", ""); if (input[0] == ',') { input.Remove(0, 1); } if (input[input.Length - 1] == ',') { input.Remove(input.Length - 1, 1); } configuration.wordsBlacklist = input.ToString().Split(','); break; } case "D4"://obfuscate user ids { configuration.obfuscateUserIDsFlag = true; break; } case "D5"://clear filters { configuration.usernameFilter = null; configuration.wordsBlacklist = null; configuration.keyword = null; configuration.filtersActive = false; configuration.obfuscateUserIDsFlag = false; break; } case "D6"://export { Console.WriteLine("Exporting...\n"); choice = 6; break; } } } while (choice != 6); conversationExporter.ExportConversation(configuration); }