private void InitConfig() { // In real project it is better to use an external file. // Load it and initialize Snipe using SnipeConfig.Init() or SnipeConfig.InitFromJSON() // Hardcoded config values var config = new ExpandoObject() { ["snipe_client_key"] = "client-vs8mf4ps9e2j", ["auth"] = new ExpandoObject() { ["host"] = "dev.snipe.dev", ["port"] = 10000, ["websocket"] = "wss://dev.snipe.dev/wss_10000/", }, ["server"] = new ExpandoObject() { ["host"] = "dev.snipe.dev", ["port"] = 10100, ["websocket"] = "wss://dev.snipe.dev/wss_10100/", }, }; SnipeConfig.Init(config); }
public static void Init(ExpandoObject data) { Instance = new SnipeConfig(); Instance.snipe_client_key = data.SafeGetString("snipe_client_key"); Instance.server = new SnipeServerConfig(data.SafeGetValue <ExpandoObject>("server")); Instance.auth = new SnipeServerConfig(data.SafeGetValue <ExpandoObject>("auth")); Instance.InitAppInfo(); }
public static void InitFromJSON(string json_string) { Instance = JsonUtility.FromJson <SnipeConfig>(json_string); Instance.InitAppInfo(); }