private static void Main(string[] args) { Console.Title = "Loading..."; XmlConfigurator.ConfigureAndWatch(new FileInfo("_gameserver.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; using (var db = new Database()) { Usage = -1; manager = new RealmManager(db); autoRestart = Settings.NETWORKING.RESTART.ENABLE_RESTART; 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 (autoRestart) { chat = manager.Chat; uptime = DateTime.Now; restart(); usage(); } Console.Title = Settings.GAMESERVER.TITLE; Logger.Info("Server initialized."); Console.CancelKeyPress += delegate { Shutdown?.Set(); }; while (Console.ReadKey(true).Key != ConsoleKey.Escape) { ; } Logger.Info("Terminating..."); server?.Stop(); policy?.Stop(); manager?.Stop(); Shutdown?.Dispose(); Logger.Info("Server terminated."); Environment.Exit(0); } }
private static void Main(string[] args) { Console.Title = "Loading..."; XmlConfigurator.ConfigureAndWatch(new FileInfo("_gameserver.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; using (var db = new Database()) { GameUsage = -1; Manager = new RealmManager(db); AutoRestart = Settings.NETWORKING.RESTART.ENABLE_RESTART; Manager.Initialize(); Manager.Run(); Log._("Message", Message.Messages.Count); Server server = new Server(Manager); PolicyServer policy = new PolicyServer(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; Settings.DISPLAY_SUPPORTED_VERSIONS(); Log.Info("Initializing GameServer..."); policy.Start(); server.Start(); if (AutoRestart) { Chat = Manager.Chat; Uptime = DateTime.Now; Restart(); Usage(); } Console.Title = Settings.GAMESERVER.TITLE; Log.Info("Initializing GameServer... OK!"); Console.CancelKeyPress += delegate { Shutdown?.Set(); }; while (Console.ReadKey(true).Key != ConsoleKey.Escape) { ; } Log.Info("Terminating..."); server?.Stop(); policy?.Stop(); Manager?.Stop(); Shutdown?.Dispose(); Log.Warn("Terminated GameServer."); Thread.Sleep(1000); Environment.Exit(0); } }
private static void Main(string[] args) { Console.Title = "Fabiano Swagger of Doom - World Server"; try { XmlConfigurator.ConfigureAndWatch(new FileInfo("resources/config/log4net_wServer.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; Settings = new SimpleSettings("resources/config/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 = "Loading..."; XmlConfigurator.ConfigureAndWatch(new FileInfo("_gameserver.config")); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.Name = "Entry"; if (!Directory.Exists(LootCachePath)) { Directory.CreateDirectory(LootCachePath); } if (!Directory.Exists(MonsterCachePath)) { Directory.CreateDirectory(MonsterCachePath); } if (!Directory.Exists(TaskCachePath)) { Directory.CreateDirectory(TaskCachePath); } if (!Directory.Exists(AchievementCachePath)) { Directory.CreateDirectory(AchievementCachePath); } try { var db = new Database(); GameUsage = -1; Manager = new RealmManager(db); AutoRestart = Settings.NETWORKING.RESTART.ENABLE_RESTART; Manager.Initialize(); Manager.Run(); var policy = new PolicyServer(); var server = new Server(); Console.CancelKeyPress += (sender, e) => e.Cancel = true; policy.Start(); server.Start(); if (AutoRestart) { Chat = Manager.Chat; Uptime = DateTime.Now; Restart(); } Console.Title = Settings.GAMESERVER.TITLE; Console.CancelKeyPress += delegate { Shutdown?.Set(); }; while (Console.ReadKey(true).Key != ConsoleKey.Escape) { ; } Log.Info("Terminating..."); policy?.Stop(); server?.Stop(); Manager?.Stop(); Manager?.Database.Dispose(); Shutdown?.Dispose(); Log.Warn("Terminated GameServer."); Thread.Sleep(1000); Environment.Exit(0); } catch (Exception e) { ForceShutdown(e); } }
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 = "Zy's Realm - 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"); DebugMode = Settings.GetValue <bool>("debugMode", "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."); if (isStopped()) { 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(); } }