Files
raven-launcher/Program.cs
2021-11-29 23:11:24 +00:00

49 lines
1.6 KiB
C#

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("Waiting for server to exit");
if (ServerProcess != null)
ServerProcess.WaitForExit();
// 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();
// }