public class WorldInfo
{
public Weather DefaultWeather { get; set; } = (Weather) 2;
public TimeSpan DefaultTime { get; set; } = new TimeSpan(12, 0, 0);
}
public Main()
{
if(!File.Exists(@"./Weather.jason"))
{
WorldInfo worldInfo = new WorldInfo();
string json_from_object = NAPI.Util.ToJson(worldInfo);
File.WriteAllLines(@"./Weather.json", new string[] { json_from_object });
Console.WriteLine("Wrote New Settings Configuration for Weather");
return;
}
string result = File.ReadAllText(@"./Weather.json");
WorldInfo new_wather_settings = NAPI.Util.FromJson<WorldInfo>(result);
Console.WriteLine(new_wather_settings.DefaultTime);
}
Alles anzeigen