static bool PromptDestruct(bool isFolder) { Console.Write("\n\nDestruct original processed file{0} ? (y / N) ", isFolder ? "s" : ""); var input = Console.ReadLine(); var result = input == "y" || input == "Y"; Console.Write("Original processed file{0} ", isFolder ? "s" : ""); ConsoleManager.Write((result ? "WILL" : "WON'T") + " be destroyed", ConsoleManager.Colors.Important); Console.WriteLine(" after processing"); return(result); }
static string PromptPassword(bool reType, Security.ProcessTypes method) { var password = ""; var reTypePassword = ""; while (password == "") { Console.Write("\n{0} :{1}", reType ? "Type password again" : "Password", reType ? " " : " "); var input = new ConsoleKeyInfo(); while (input.Key != ConsoleKey.Enter) { input = Console.ReadKey(true); if (input.Key == ConsoleKey.Backspace) { if (password.Length != 0) { password = password.Substring(0, password.Length - 1); Console.Write("\b \b"); } } else if (input.Key != ConsoleKey.Enter) { password += input.KeyChar; ConsoleManager.Write("*", ConsoleManager.Colors.Password); } } if (password == "") { ConsoleManager.Write("Please enter a password...", ConsoleManager.Colors.Error); } else { if (!reType) { while (password != reTypePassword && method == Security.ProcessTypes.encrypt) { if (password != reTypePassword && reTypePassword != "") { ConsoleManager.Write("\nPassword don't match", ConsoleManager.Colors.Error); } reTypePassword = PromptPassword(true, method); } } } } return(password); }