public void Reload_SimpleSettings_Ok() { var settings = new SimpleSettings(); settings.IntProperty = 10; Assert.NotEqual(DefaultIntPropertyValue, settings.IntProperty); settings.Reload(); Assert.Equal(DefaultIntPropertyValue, settings.IntProperty); }
private static void Main(string[] args) { Console.Title = "wServer"; try { XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net_wServer.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; Settings = new SimpleSettings("wServer"); new Database(); manager = new RealmManager( Settings.GetValue <int>("maxClients", "50"), Settings.GetValue <int>("tps", "20")); WhiteList = Settings.GetValue <bool>("whiteList", "false"); Verify = Settings.GetValue <bool>("verifyEmail", "false"); WhiteListTurnOff = Settings.GetValue <DateTime>("whitelistTurnOff"); manager.Initialize(); manager.Run(); Server server = new Server(manager); PolicyServer policy = new PolicyServer(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; policy.Start(); server.Start(); new Thread(AutoNotify).Start(); if (Settings.GetValue <bool>("broadcastNews", "false") && File.Exists("news.txt")) { new Thread(autoBroadcastNews).Start(); } log.Info("Server initialized."); uint key = 0; while ((key = (uint)Console.ReadKey(true).Key) != (uint)ConsoleKey.Escape) { if (key == (2 | 80)) { Settings.Reload(); } } log.Info("Terminating..."); server.Stop(); policy.Stop(); manager.Stop(); log.Info("Server terminated."); } catch (Exception e) { log.Fatal(e); foreach (var c in manager.Clients) { c.Value.Disconnect(); } Console.ReadLine(); } }
private static void Main(string[] args) { Console.Title = "FSOD"; try { XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net_wServer.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; Settings = new SimpleSettings("wServer"); new Database( Settings.GetValue <string>("db_host", "127.0.0.1"), Settings.GetValue <string>("db_database", "rotmgprod"), Settings.GetValue <string>("db_user", "root"), Settings.GetValue <string>("db_auth", "")); manager = new RealmManager( Settings.GetValue <int>("maxClients", "100"), Settings.GetValue <int>("tps", "20")); WhiteList = Settings.GetValue <bool>("whiteList", "false"); Verify = Settings.GetValue <bool>("verifyEmail", "false"); WhiteListTurnOff = Settings.GetValue <DateTime>("whitelistTurnOff"); manager.Initialize(); manager.Run(); Server server = new Server(manager); PolicyServer policy = new PolicyServer(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; policy.Start(); server.Start(); if (Settings.GetValue <bool>("broadcastNews", "false") && File.Exists("news.txt")) { new Thread(autoBroadcastNews).Start(); } log.Info("Server initialized."); foreach (var type in typeof(World).Assembly.GetTypes()) { if (type.IsAbstract || !typeof(World).IsAssignableFrom(type)) { continue; } if (type.GetConstructors().First().GetParameters().Length > 0) { continue; } var world = (World)type.Assembly.CreateInstance(type.FullName); if (world == null) { log.Warn($"Cant make World {type.Name}"); } if (world?.Difficulty == -1) { log.Warn($"World {type.Name} has the default difficulty (-1)"); } world?.Dispose(); } uint key = 0; while ((key = (uint)Console.ReadKey(true).Key) != (uint)ConsoleKey.Escape) { if (key == (2 | 80)) { Settings.Reload(); } } log.Info("Terminating..."); server.Stop(); policy.Stop(); manager.Stop(); log.Info("Server terminated."); } catch (Exception e) { log.Fatal(e); foreach (var c in manager.Clients) { c.Value.Disconnect(); } Console.ReadLine(); } }
private static void Main(string[] args) { Console.Title = "Fabiano Swagger of Doom - World Server"; try { XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net_wServer.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; Settings = new SimpleSettings("wServer"); new Database( Settings.GetValue<string>("db_host", "127.0.0.1"), Settings.GetValue<string>("db_database", "rotmgprod"), Settings.GetValue<string>("db_user", "root"), Settings.GetValue<string>("db_auth", "")); manager = new RealmManager( Settings.GetValue<int>("maxClients", "100"), Settings.GetValue<int>("tps", "20")); WhiteList = Settings.GetValue<bool>("whiteList", "false"); Verify = Settings.GetValue<bool>("verifyEmail", "false"); WhiteListTurnOff = Settings.GetValue<DateTime>("whitelistTurnOff"); manager.Initialize(); manager.Run(); Server server = new Server(manager); PolicyServer policy = new PolicyServer(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; policy.Start(); server.Start(); if(Settings.GetValue<bool>("broadcastNews", "false") && File.Exists("news.txt")) new Thread(autoBroadcastNews).Start(); log.Info("Server initialized."); uint key = 0; while ((key = (uint)Console.ReadKey(true).Key) != (uint)ConsoleKey.Escape) { if (key == (2 | 80)) Settings.Reload(); } log.Info("Terminating..."); server.Stop(); policy.Stop(); manager.Stop(); log.Info("Server terminated."); } catch (Exception e) { log.Fatal(e); foreach (var c in manager.Clients) { c.Value.Disconnect(); } Console.ReadLine(); } }
private static void Main(string[] args) { Console.Title = "Rotux - World Server"; try { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; Settings = new SimpleSettings("wServer"); new Database( Settings.GetValue <string>("db_host", "127.0.0.1"), Settings.GetValue <string>("db_database", "rotmgprod"), Settings.GetValue <string>("db_user", "root"), Settings.GetValue <string>("db_auth", "")); manager = new RealmManager( Settings.GetValue <int>("maxClients", "100"), Settings.GetValue <int>("tps", "20")); WhiteList = Settings.GetValue <bool>("whiteList", "false"); Verify = Settings.GetValue <bool>("verifyEmail", "false"); WhiteListTurnOff = Settings.GetValue <DateTime>("whitelistTurnOff"); manager.Initialize(); manager.Run(); Server server = new Server(manager); PolicyServer policy = new PolicyServer(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; policy.Start(); server.Start(); if (Settings.GetValue <bool>("broadcastNews", "false") && File.Exists("news.txt")) { new Thread(autoBroadcastNews).Start(); } Console.WriteLine("Server initialized."); uint key = 0; while ((key = (uint)Console.ReadKey(true).Key) != (uint)ConsoleKey.Escape) { if (key == (2 | 80)) { Settings.Reload(); } } Console.WriteLine("Terminating..."); server.Stop(); policy.Stop(); manager.Stop(); Console.WriteLine("Server terminated."); } catch (Exception e) { Console.WriteLine(e); foreach (var c in manager.Clients) { c.Value.Disconnect(); } Console.ReadLine(); } }