utils for JSON files and RNG/rolling, abstracted arg parsing for commands

This commit is contained in:
Kyle Belanger
2024-02-18 23:11:58 -05:00
parent d2552b74b7
commit 7445a1f5d8
9 changed files with 232 additions and 10 deletions

View File

@@ -0,0 +1,25 @@
namespace BLHX.Server.Common.Utils;
public class Config : Singleton<Config>
{
public string Address { get; set; } = "192.168.1.4";
public uint Port { get; set; } = 20000;
public static void Load()
{
Instance = JSON.Load<Config>(JSON.ConfigPath);
#if DEBUG
Logger.c.Log($"Loaded Config:\n{JSON.Stringify(Instance)}");
#endif
}
public static void Save()
{
JSON.Save(JSON.ConfigPath, Instance);
#if DEBUG
Logger.c.Log("Saved Config");
#endif
}
}