public static void Init() { try { conf = LoadConf(); } catch (FormatException ex) { Console.Error.WriteLine(ex.Message); Environment.Exit(1); } VrLifeDbContext.SetConfig(conf); }
private static void OnDebug() { JObject consoleLog = new JObject(); consoleLog["type"] = "console"; JObject mainConf = new JObject(); mainConf["debug"] = true; mainConf["listen"] = "0.0.0.0"; mainConf["serverAddress"] = "127.0.0.1"; mainConf["tcp-port"] = 8765; mainConf["udp-port"] = 8766; mainConf["main"] = true; JObject database = new JObject(); database["type"] = "mysql"; database["host"] = "localhost"; database["port"] = 3306; database["username"] = "******"; database["password"] = "******"; database["database"] = "dev"; mainConf["database"] = database; JArray mainLogs = new JArray(); JObject mainLog = new JObject(); mainLog["type"] = "file"; mainLog["path"] = "./vrlife-main-server.log"; mainLogs.Add(mainLog); mainLogs.Add(consoleLog); mainConf["log"] = mainLogs; JObject compConf = new JObject(); compConf["debug"] = true; compConf["listen"] = "0.0.0.0"; compConf["serverAddress"] = "127.0.0.1"; compConf["tcp-port"] = 8865; compConf["udp-port"] = 8866; compConf["main"] = false; compConf["mainServer"] = "127.0.0.1:8766"; JArray compLogs = new JArray(); JObject compLog = new JObject(); compLog["type"] = "file"; compLog["path"] = "./vrlife-comp-server.log"; compLogs.Add(compLog); compLogs.Add(consoleLog); compConf["log"] = compLogs; Config mainConfig = Config.Parse(mainConf); Config compConfig = Config.Parse(compConf); VrLifeDbContext.SetConfig(mainConfig); ProviderServer providerServer = new ProviderServer(); providerServer.Init(mainConfig); providerServer.Start(); ForwarderServer forwarderServer = new ForwarderServer(); forwarderServer.Init(compConfig); forwarderServer.Start(); }