global using System.Diagnostics; // Prevent from ending if CTL+C is pressed. Console.TreatControlCAsInput = true; Console.WriteLine($"AyaNova server launcher {AyaNovaVersion.VersionString}"); //================== LAUNCH AYANOVA SERVER ================== //Go UP one folder from the current launcher folder which should *always* be contained within the AyaNova.exe containing folder if it was installed var ServerExeFolderPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..")); ProcessStartInfo ServerStartInfo = new ProcessStartInfo(); ServerStartInfo.FileName = "AyaNova.exe"; ServerStartInfo.WorkingDirectory = ServerExeFolderPath; ServerStartInfo.UseShellExecute = true; var ServerProcess = Process.Start(ServerStartInfo); Console.WriteLine("#############################################"); Console.WriteLine("Press CTL-C key to shut down AyaNova Server"); Console.WriteLine("#############################################"); bool Quit = false; ConsoleKeyInfo cki; do { cki = Console.ReadKey(false); if (cki.Key == ConsoleKey.C && (cki.Modifiers & ConsoleModifiers.Control) != 0) { Quit = true; } else { Console.WriteLine("Press CTL-C key to shut down AyaNova Server"); } //Console.WriteLine(cki.Key.ToString()); } while (!Quit); if (ServerProcess != null) { ServerProcess.CloseMainWindow(); ServerProcess.Close(); }