This commit is contained in:
2021-11-27 00:36:15 +00:00
parent 6364c0d46e
commit 23dd186ce6

View File

@@ -1,10 +1,20 @@
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 ==================
var AyaNovaProcess = System.Diagnostics.Process.Start(@"../AyaNova.exe");
//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");
@@ -24,4 +34,11 @@ do
Console.WriteLine("Press CTL-C key to shut down AyaNova Server");
}
//Console.WriteLine(cki.Key.ToString());
} while (!Quit);
} while (!Quit);
if (ServerProcess != null)
{
ServerProcess.CloseMainWindow();
ServerProcess.Close();
}