public static void Main(string[] args) { bool_0 = true; DateTime now = DateTime.Now; Output.InitializeStream(true, OutputLevel.DebugInformation); Output.WriteLine("Initializing BoomBang game environment..."); ConfigManager.Initialize(Constants.DataFileDirectory + @"\server-main.cfg"); Output.SetVerbosityLevel((OutputLevel)ConfigManager.GetValue("output.verbositylevel")); foreach (string str in args) { Output.WriteLine("Command line argument: " + str); Input.ProcessInput(str.Split(new char[] { ' ' })); } try { Output.WriteLine("Initializing MySQL manager..."); SqlDatabaseManager.Initialize(); Output.WriteLine("Setting up server listener on port " + ((int)ConfigManager.GetValue("net.bind.port")) + "..."); boomBangTcpListener_0 = new BoomBangTcpListener(new IPEndPoint(IPAddress.Any, (int)ConfigManager.GetValue("net.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback(SessionManager.HandleIncomingConnection)); using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { Output.WriteLine("Resetting database counters and statistics..."); smethod_0(client); Output.WriteLine("Initializing game components and workers..."); DataRouter.Initialize(); GlobalHandler.Initialize(); SessionManager.Initialize(); CharacterInfoLoader.Initialize(); UserCredentialsAuthenticator.Initialize(); RegisterManager.Initialize(); Class1.smethod_0(); LaptopHandler.Initialize(); CatalogManager.Initialize(client); FlowerPowerManager.Initialize(); NewsCacheManager.Initialize(client); Navigator.Initialize(client); SpaceManager.Initialize(client); SpaceInfoLoader.Initialize(); SpaceHandler.Initialize(); GameHandler.Initialize(); CrossdomainPolicy.Initialize(@"Data\crossdomain.xml"); WordFilterManager.Initialize(client); AdvertisementManager.Initialize(); ContestHandler.Initialize(); SilverCoinsWorker.Initialize(); ModerationBanManager.Initialize(client); } } catch (Exception exception) { HandleFatalError("Could not initialize BoomBang game environment: " + exception.Message + "\nStack trace: " + exception.StackTrace); return; } TimeSpan span = (TimeSpan)(DateTime.Now - now); Output.WriteLine("The server has initialized successfully (" + Math.Round(span.TotalSeconds, 2) + " seconds). Ready for connections.", OutputLevel.Notification); Output.WriteLine("Pulsa ENTER e introduce un comando. Ten una guía de comandos escribiendo HELP", OutputLevel.Notification); Console.Beep(); }
public static void ProcessInput(string[] Args) { string key = Args[0].ToLower(); if (key != null) { int num2 = 0; { Dictionary <string, int> dictionary1 = new Dictionary <string, int>(9); dictionary1.Add("delay", 0); dictionary1.Add("restart", 1); dictionary1.Add("crash", 2); dictionary1.Add("stop", 3); dictionary1.Add("cls", 4); dictionary1.Add("recache_news", 5); dictionary1.Add("laptop_alert", 6); dictionary1.Add("lock", 7); dictionary1.Add("disconnect", 8); switch (num2) { case 0: { int result = 0x1388; if (Args.Length > 1) { int.TryParse(Args[1], out result); } Thread.Sleep(result); return; } case 1: Process.Start(Environment.CurrentDirectory + @"\BoomBang.exe", "\"delay 1500\""); Program.Stop(); return; case 2: Environment.FailFast(string.Empty); return; case 3: Program.Stop(); return; case 4: Output.ClearStream(); return; case 5: NewsCacheManager.ReCacheNews(); return; case 6: foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, InputFilter.MergeString(Args, 1), 2), false); } return; case 7: SessionManager.RejectIncomingConnections = true; return; case 8: SessionManager.StopSession(Convert.ToUInt32(Args[1])); return; } } Output.WriteLine("'" + Args[0].ToLower() + "' is not recognized as a command or internal operation.", OutputLevel.Warning); } }
public static void Main(string[] args) { mAlive = true; DateTime InitStart = DateTime.Now; // Set up basic output Console.WriteLine("Initializing Snowlight..."); // Cannot be localized before config+lang is loaded // Load configuration, translation, and re-configure output from config data ConfigManager.Initialize(Constants.DataFileDirectory + "server-main.cfg"); Output.InitializeStream(true, (OutputLevel)ConfigManager.GetValue("output.verbositylevel")); Output.WriteLine("Initializing Snowlight..."); Localization.Initialize(Constants.LangFileDirectory + "lang_" + ConfigManager.GetValue("lang") + ".lang"); // Process args foreach (string arg in args) { Output.WriteLine(Localization.GetValue("core.init.cmdarg", arg)); Input.ProcessInput(arg.Split(' ')); } try { // Initialize and test database Output.WriteLine(Localization.GetValue("core.init.mysql")); SqlDatabaseManager.Initialize(); // Initialize network components Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.bind.port").ToString())); mServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.bind.ip"), (int)ConfigManager.GetValue("net.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( SessionManager.HandleIncomingConnection)); /*Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.cmd.bind.port").ToString())); * musServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.cmd.bind.ip"), (int)ConfigManager.GetValue("net.cmd.bind.port")), * (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( * CommandListener.parse));*/ using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { Output.WriteLine(Localization.GetValue("core.init.dbcleanup")); PerformDatabaseCleanup(MySqlClient); Output.WriteLine(Localization.GetValue("core.init.game")); // Core DataRouter.Initialize(); // Sessions, characters SessionManager.Initialize(); // RandomGenerator.Initialize(); StatisticsSyncUtil.Initialize(); //Global Handler Global.Initialize(); //Login Handler Login.Initialize(); CharacterInfoLoader.Initialize(); UserCredentialsAuthenticator.Initialize(); //Bpad Handler LaptopHandler.Initialize(); //FlowerHandler FlowerPower.Initialize(); ContestHandler.Initialize(); CatalogManager.Initialize(MySqlClient); NewsCacheManager.Initialize(MySqlClient); SpaceInfoLoader.Initialize(); Navigator.Initialize(MySqlClient); LaptopHandler.Initialize(); UserCredentialsAuthenticator.Initialize(); SpaceManager.Initialize(MySqlClient); SpaceHandler.Initialize(); SilverCoinsWorker.Initialize(); } } catch (Exception e) { HandleFatalError(Localization.GetValue("core.init.error.details", new string[] { e.Message, e.StackTrace })); return; } // Init complete TimeSpan TimeSpent = DateTime.Now - InitStart; Output.WriteLine(Localization.GetValue("core.init.ok", Math.Round(TimeSpent.TotalSeconds, 2).ToString()), OutputLevel.Notification); Output.WriteLine((string)Localization.GetValue("core.init.ok.cmdinfo"), OutputLevel.Notification); Console.Write("$" + Environment.UserName.ToLower() + "@snowlight> "); Console.Beep(); Input.Listen(); // This will make the main thread process console while Program.Alive. }
public static void ProcessInput(string[] Args) { string key = Args[0].ToLower(); if (key != null) { int num2 = 0; { Dictionary <string, int> dictionary1 = new Dictionary <string, int>(9); dictionary1.Add("delay", 0); dictionary1.Add("restart", 1); dictionary1.Add("crash", 2); dictionary1.Add("stop", 3); dictionary1.Add("cls", 4); dictionary1.Add("recache_news", 5); dictionary1.Add("laptop_alert", 6); dictionary1.Add("lock", 7); dictionary1.Add("disconnect", 8); dictionary1.Add("HELP", 9); dictionary1.Add("help", 9); switch (num2) { case 0: { int result = 0x1388; if (Args.Length > 1) { int.TryParse(Args[1], out result); } Thread.Sleep(result); return; } case 1: Process.Start(Environment.CurrentDirectory + @"\BoomBang.exe", "\"delay 1500\""); Program.Stop(); return; case 2: Environment.FailFast(string.Empty); return; case 3: Program.Stop(); return; case 4: Output.ClearStream(); return; case 5: NewsCacheManager.ReCacheNews(); return; case 6: foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, InputFilter.MergeString(Args, 1), 2), false); } return; case 7: SessionManager.RejectIncomingConnections = true; return; case 8: SessionManager.StopSession(Convert.ToUInt32(Args[1])); return; case 9: Console.WriteLine("restart -> Reinicia el server"); Console.WriteLine("crash -> Apaga el server"); Console.WriteLine("stop -> Cierra el server"); Console.WriteLine("laptop_alert -> Enviar mensaje de BBTeam*"); Console.WriteLine("cls -> Borrar todas las las líneas del servidor"); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("*Para que haga efecto el laptop_alert debes escribir algo como a continuación:"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("laptop_alert Mensaje a enviar"); return; } } Output.WriteLine("'" + Args[0].ToLower() + "' is not recognized as a command or internal operation.", OutputLevel.Warning); } }