mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-14 07:24:50 +01:00
utils for JSON files and RNG/rolling, abstracted arg parsing for commands
This commit is contained in:
25
BLHX.Server.Common/Utils/Config.cs
Normal file
25
BLHX.Server.Common/Utils/Config.cs
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user