private static void ChangeConfiguration(Configuration config) { while (true) { WriteToConsole.Text("Current Settings:\n\t" + config.ToString()); WriteToConsole.Text("Which Setting would you like to change?"); WriteToConsole.Text("\t#Col:Green#1# : Check Interval\n\t#Col:Green#2# : Notify on finish\n\t#Col:Green#3# : Number of Notifications\n\t#Col:Green#4# : Back to Main Menu"); string userInput = Console.ReadLine(); if (userInput == "1") { Console.WriteLine("Please Enter the Number of Seconds:"); try { config.sleepTimerInSeconds = int.Parse(Console.ReadLine()); } catch (FormatException ex) { WriteToConsole.Error("Could not Read Input!"); continue; } } else if (userInput == "2") { config.notifyOnFinish = !config.notifyOnFinish; } else if (userInput == "3") { Console.WriteLine("Please Enter the Number of Notifications:"); try { config.numberOfNotifications = int.Parse(Console.ReadLine()); } catch (FormatException ex) { WriteToConsole.Error("Could not Read Input!"); continue; } } else if (userInput == "4") { config.Save(); return; } else { WriteToConsole.Error("Could not Read Input!");; continue; } Console.Clear(); } }
static void Main(string[] args) { //1264x720 while (Process.GetProcessesByName("SodaDungeon2").Length < 1) { WriteToConsole.Error("Could not detect the Game!"); WriteToConsole.Text("Please make sure, that the game is running. Press Enter once you have started the game."); Console.ReadLine(); } sodaGame = Process.GetProcessesByName("SodaDungeon2")[0].MainWindowHandle; Configuration config = new Configuration(); config.Save(); while (true) { WriteToConsole.Text("What would you like to Do? Type the coresponding Number."); string shutdownStatus = (shutDownOnFinish) ? "#Col:Green#Enabled#" : "#Col:Red#Disabled#"; WriteToConsole.Text($"\t#Col:Green#1# : Start\n\t#Col:Green#2# : change your Configuration\n\t#Col:Green#3# : Change option 'Shutdown on finish' currently set to: {shutdownStatus}\n\t#Col:Green#4# : Exit"); string userInput = Console.ReadLine(); if (userInput == "1") { RunTool(config); } else if (userInput == "2") { ChangeConfiguration(config); } else if (userInput == "3") { shutDownOnFinish = !shutDownOnFinish; } else if (userInput == "4") { break; } else { WriteToConsole.Error("Could not Read Input!"); continue; } Console.Clear(); } }