This commit is contained in:
39
Program.cs
39
Program.cs
@@ -1,43 +1,10 @@
|
||||
global using System.Text.Json;
|
||||
global using System.Text.Json.Serialization;
|
||||
|
||||
|
||||
// Prevent from ending if CTL+C is pressed.
|
||||
Console.TreatControlCAsInput = true;
|
||||
Console.WriteLine($"AyaNova server launcher {AyaNovaVersion.VersionString}");
|
||||
//================== LAUNCH AYANOVA SERVER ==================
|
||||
|
||||
AyConfig cfg = null;
|
||||
|
||||
var ConfigFileName = @"config.json";
|
||||
var json = string.Empty;
|
||||
bool FirstTime=false;
|
||||
//Read configuration or create if not exist
|
||||
if (File.Exists(ConfigFileName))
|
||||
{
|
||||
json = File.ReadAllText(ConfigFileName);
|
||||
cfg = JsonSerializer.Deserialize<AyConfig>(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg = new AyConfig();
|
||||
FirstTime=true;
|
||||
}
|
||||
|
||||
if(FirstTime){
|
||||
Console.WriteLine("Configuration file not found; using default values");
|
||||
}
|
||||
Console.WriteLine("Current configuration:");
|
||||
|
||||
//iterate / prompt for each value
|
||||
|
||||
|
||||
//write configuration
|
||||
cfg = new AyConfig();
|
||||
json = JsonSerializer.Serialize(cfg);
|
||||
File.WriteAllText(ConfigFileName, json);
|
||||
|
||||
|
||||
|
||||
|
||||
var AyaNovaProcess = System.Diagnostics.Process.Start(@"../AyaNova.exe");
|
||||
|
||||
|
||||
Console.WriteLine("Press CTL-C keys to shut down AyaNova Server");
|
||||
|
||||
Reference in New Issue
Block a user