Expand|Select|Wrap|Line Numbers
- ConsoleKeyInfo input;
- do
- {
- if (File.Exists("info.txt") == true) ;
- else Console.WriteLine("File not found! \nPress any key to try again..."); Console.ReadKey(true);
- } while (File.Exists("info.txt") == false);
- StreamReader reader = new StreamReader("info.txt");
- do
- {
- input = Console.ReadKey(true);
- if (input.Key == ConsoleKey.R && input.Modifiers == ConsoleModifiers.Control)
- {
- Process.Start(reader.ReadLine());
- }
- if (input.Key == ConsoleKey.B && input.Modifiers == ConsoleModifiers.Control)
- {
- Process.Start(reader.ReadLine());
- }
- } while (input.Key != ConsoleKey.Escape);
Whether pressing (R+Ctrl) or (B+Ctrl), at the first press the console readlines the first line, and at the second keypress the console readlines the second line; afterwards since there is no third line, pressing those keys crashes the console.
Thanks for help.