using Newtonsoft.Json; using Newtonsoft.Json.Linq; static class Config{ static Config(){ if(!File.Exists("config.json")){ throw new Exception("File not found: config.json"); } JObject obj = JsonConvert.DeserializeObject(File.ReadAllText("config.json")) ?? throw new Exception("Invalid config file"); listen_port=(int)obj["listen_port"]!; ssl_address=(string)obj["ssl_address"]!; ssl_port=(int)obj["ssl_port"]!; tcp_address=(string)obj["tcp_address"]!; tcp_port=(int)obj["tcp_port"]!; } public static int listen_port; public static string ssl_address; public static int ssl_port; public static string tcp_address; public static int tcp_port; }