Compare commits

...

2 Commits

Author SHA1 Message Date
c6bd342e87 Merge remote-tracking branch 'origin/master' 2024-02-12 01:37:32 +01:00
82e14c8b9e Use do-while instead of convoluted setups. 2024-02-12 01:37:28 +01:00

View File

@ -46,15 +46,15 @@ public static class Setup
switch (pressedKey)
{
case ConsoleKey.D1:
Console.WriteLine("New LogLevel:");
string[] levels = Enum.GetNames<LogLevel>();
for(int i = 0; i < levels.Length; i++)
Console.WriteLine($"{i}) {levels[i]}");
int selected;
while (!int.TryParse(Console.ReadKey().KeyChar.ToString(), out selected) || selected < 0 ||
selected >= levels.Length)
{//NYAA
}
do
{
Console.Clear();
Console.WriteLine("New LogLevel:");
for (int i = 0; i < levels.Length; i++)
Console.WriteLine($"{i}) {levels[i]}");
} while (!int.TryParse(Console.ReadKey().KeyChar.ToString(), out selected) || selected < 0 || selected >= levels.Length);
Console.WriteLine();//NewLine after Input
c.LogLevel = Enum.Parse<LogLevel>(levels[selected]);
break;