public static void Initialize() { ServerStarted = DateTime.Now; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(); Console.WriteLine(" ____ __ ________ _____ __"); Console.WriteLine(@" / __ \/ /_ _______/ ____/ |/ / / / /"); Console.WriteLine(" / /_/ / / / / / ___/ __/ / /|_/ / / / / "); Console.WriteLine(" / ____/ / /_/ (__ ) /___/ / / / /_/ / "); Console.WriteLine(@" /_/ /_/\__,_/____/_____/_/ /_/\____/ "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" " + PrettyVersion + " <Build " + PrettyBuild + ">"); Console.WriteLine(" http://PlusIndustry.com"); Console.WriteLine(""); Console.Title = "Loading Plus Emulator"; _defaultEncoding = Encoding.Default; Console.WriteLine(""); Console.WriteLine(""); CultureInfo = CultureInfo.CreateSpecificCulture("en-GB"); try { _configuration = new ConfigurationData(Path.Combine(Application.StartupPath, @"config.ini")); var connectionString = new MySqlConnectionStringBuilder { ConnectionTimeout = 10, Database = GetConfig().data["db.name"], DefaultCommandTimeout = 30, Logging = false, MaximumPoolSize = uint.Parse(GetConfig().data["db.pool.maxsize"]), MinimumPoolSize = uint.Parse(GetConfig().data["db.pool.minsize"]), Password = GetConfig().data["db.password"], Pooling = true, Port = uint.Parse(GetConfig().data["db.port"]), Server = GetConfig().data["db.hostname"], UserID = GetConfig().data["db.username"], AllowZeroDateTime = true, ConvertZeroDateTime = true, }; _manager = new DatabaseManager(connectionString.ToString()); if (!_manager.IsConnected()) { log.Error("Failed to connect to the specified MySQL server."); Console.ReadKey(true); Environment.Exit(1); return; } log.Info("Connected to Database!"); //Reset our statistics first. using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("TRUNCATE `catalog_marketplace_data`"); dbClient.RunQuery("UPDATE `rooms` SET `users_now` = '0' WHERE `users_now` > '0';"); dbClient.RunQuery("UPDATE `users` SET `online` = '0' WHERE `online` = '1'"); dbClient.RunQuery("UPDATE `server_status` SET `users_online` = '0', `loaded_rooms` = '0'"); } //Get the configuration & Game set. _languageManager = new LanguageManager(); _languageManager.Init(); _settingsManager = new SettingsManager(); _settingsManager.Init(); _figureManager = new FigureDataManager(); _figureManager.Init(); //Have our encryption ready. HabboEncryptionV2.Initialize(new RSAKeys()); //Make sure RCON is connected before we allow clients to connect. _rcon = new RCONSocket(GetConfig().data["rcon.tcp.bindip"], int.Parse(GetConfig().data["rcon.tcp.port"]), GetConfig().data["rcon.tcp.allowedaddr"].Split(Convert.ToChar(";"))); //Accept connections. _connectionManager = new ConnectionHandling(int.Parse(GetConfig().data["game.tcp.port"]), int.Parse(GetConfig().data["game.tcp.conlimit"]), int.Parse(GetConfig().data["game.tcp.conperip"]), GetConfig().data["game.tcp.enablenagles"].ToLower() == "true"); _connectionManager.init(); _game = new Game(); _game.StartGameLoop(); TimeSpan TimeUsed = DateTime.Now - ServerStarted; Console.WriteLine(); log.Info("EMULATOR -> READY! (" + TimeUsed.Seconds + " s, " + TimeUsed.Milliseconds + " ms)"); } catch (KeyNotFoundException e) { log.Error("Please check your configuration file - some values appear to be missing."); log.Error("Press any key to shut down ..."); Console.ReadKey(true); Environment.Exit(1); return; } catch (InvalidOperationException e) { log.Error("Failed to initialize PlusEmulator: " + e.Message); log.Error("Press any key to shut down ..."); Console.ReadKey(true); Environment.Exit(1); return; } catch (Exception e) { log.Error("Fatal error during startup: " + e); log.Error("Press a key to exit"); Console.ReadKey(); Environment.Exit(1); } }
public static void Initialize() { Console.Clear(); ServerStarted = DateTime.Now; Console.ForegroundColor = ConsoleColor.Gray; PatchDir = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/"; Console.Title = "Butterfly Emulator"; try { _configuration = new ConfigurationData(PatchDir + "Settings/configuration.ini", false); _datebasemanager = new DatabaseManager(uint.Parse(GetConfig().data["db.pool.maxsize"]), uint.Parse(GetConfig().data["db.pool.minsize"]), GetConfig().data["db.hostname"], uint.Parse(GetConfig().data["db.port"]), GetConfig().data["db.username"], GetConfig().data["db.password"], GetConfig().data["db.name"]); int TryCount = 0; while (!_datebasemanager.IsConnected()) { TryCount++; Thread.Sleep(5000); //sleep 5sec if (TryCount > 10) { Logging.WriteLine("Failed to connect to the specified MySQL server."); Console.ReadKey(true); Environment.Exit(1); return; } } HabboEncryptionV2.Initialize(new RSAKeys()); _languageManager = new LanguageManager(); _languageManager.Init(); _game = new Game(); _game.StartGameLoop(); _figureManager = new FigureDataManager(); _figureManager.Init(); if (_configuration.data["Websocketenable"] == "true") { _webSocketManager = new WebSocketManager(527, int.Parse(GetConfig().data["game.tcp.conlimit"]), int.Parse(GetConfig().data["game.tcp.conlimit"])); } _connectionManager = new ConnectionHandeling(int.Parse(GetConfig().data["game.tcp.port"]), int.Parse(GetConfig().data["game.tcp.conlimit"]), int.Parse(GetConfig().data["game.tcp.conperip"])); if (_configuration.data["Musenable"] == "true") { _rcon = new RCONSocket(int.Parse(GetConfig().data["mus.tcp.port"]), GetConfig().data["mus.tcp.allowedaddr"].Split(new char[1] { ';' })); } StaticEvents = _configuration.data["static.events"] == "true"; Logging.WriteLine("ENVIRONMENT -> READY!"); if (Debugger.IsAttached) { Console.ForegroundColor = ConsoleColor.Yellow; Logging.WriteLine("Server is debugging: Console writing enabled"); Console.ForegroundColor = ConsoleColor.White; } else { Logging.WriteLine("Server is not debugging: Console writing disabled"); Logging.DisablePrimaryWriting(false); } } catch (KeyNotFoundException ex) { Logging.WriteLine("Please check your configuration file - some values appear to be missing."); Logging.WriteLine("Press any key to shut down ..."); Logging.WriteLine((ex).ToString()); Console.ReadKey(true); } catch (InvalidOperationException ex) { Logging.WriteLine("Failed to initialize ButterflyEmulator: " + ex.Message); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); } catch (Exception ex) { Console.WriteLine("Fatal error during startup: " + (ex).ToString()); Console.WriteLine("Press a key to exit"); Console.ReadKey(); Environment.Exit(1); } }
public SourceServer(IPAddress ipAddress, int portNumber) : base(portNumber) { this.querySocket = new SourceServerQuerySocket(ipAddress, portNumber); this.rconSocket = new RCONSocket(ipAddress, portNumber); }
public static void Initialize() { ServerStarted = DateTime.Now; Console.WindowWidth = 110; Console.WindowHeight = 45; Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(); Console.WriteLine(@" Dual Server" + PrettyBuild + " " + VersionCloud + " / Créditos: Xjoao,Paulo!"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine( Console.LargestWindowWidth > 30 ? @"-------------------------------------------------------------------------------------------------------------" : @""); Console.WriteLine(""); _defaultEncoding = Encoding.Default; Console.Title = "Dual Server | Carregando..."; CultureInfo = CultureInfo.CreateSpecificCulture("en-GB"); try { _configuration = new ConfigurationData(Path.Combine(Application.StartupPath, @"Settings/config.ini")); var connectionString = new MySqlConnectionStringBuilder { ConnectionTimeout = 10, Database = GetConfig().data["db.name"], DefaultCommandTimeout = 30, Logging = false, MaximumPoolSize = uint.Parse(GetConfig().data["db.pool.maxsize"]), MinimumPoolSize = uint.Parse(GetConfig().data["db.pool.minsize"]), Password = GetConfig().data["db.password"], Pooling = true, Port = uint.Parse(GetConfig().data["db.port"]), Server = GetConfig().data["db.hostname"], UserID = GetConfig().data["db.username"], AllowZeroDateTime = true, ConvertZeroDateTime = true, }; _manager = new DatabaseManager(connectionString.ToString()); if (!_manager.IsConnected()) { log.Warn("» Ya existe una conexión a la base de datos o hay un problema al conectarse con ella."); Console.ReadKey(true); Environment.Exit(1); return; } log.Info("» Conectado a la Base de datos!"); #region Add 2016 HotelName = Convert.ToString(GetConfig().data["hotel.name"]); Licenseto = Convert.ToString(GetConfig().data["license"]); #endregion Add 2016 //Reset our statistics first. using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("TRUNCATE `catalog_marketplace_data`"); dbClient.runFastQuery("UPDATE `rooms` SET `users_now` = '0' WHERE `users_now` > '0'"); dbClient.runFastQuery("UPDATE `users` SET `online` = '0' WHERE `online` = '1'"); dbClient.runFastQuery("UPDATE `server_status` SET `users_online` = '0', `loaded_rooms` = '0', `status` = '1'"); } _game = new Game(); _game.ContinueLoading(); //Have our encryption ready. HabboEncryptionV2.Initialize(new RSAKeys()); //Make sure MUS is working. _rcon = new RCONSocket(GetConfig().data["mus.tcp.bindip"], int.Parse(GetConfig().data["mus.tcp.port"]), GetConfig().data["mus.tcp.allowedaddr"].Split(Convert.ToChar(";"))); //Accept connections. _connectionManager = new ConnectionHandling(int.Parse(GetConfig().data["game.tcp.port"]), int.Parse(GetConfig().data["game.tcp.conlimit"]), int.Parse(GetConfig().data["game.tcp.conperip"]), GetConfig().data["game.tcp.enablenagles"].ToLower() == "true"); _connectionManager.Init(); //_game.StartGameLoop(); TimeSpan TimeUsed = DateTime.Now - ServerStarted; Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; log.Info("» CLOUD SERVER -> LISTO!! (" + TimeUsed.Seconds + " s, " + TimeUsed.Milliseconds + " ms)"); Console.ResetColor(); IsLive = true; } catch (KeyNotFoundException e) { log.ErrorFormat("Please check your configuration file - some values appear to be missing.", ConsoleColor.Red); log.Error("Press any key to shut down ..."); ExceptionLogger.LogException(e); Console.ReadKey(true); Environment.Exit(1); return; } catch (InvalidOperationException e) { log.Error("Failed to initialize CloudServer: " + e.Message); log.Error("Press any key to shut down ..."); Console.ReadKey(true); Environment.Exit(1); return; } catch (Exception e) { log.Error("Fatal error during startup: " + e); log.Error("Press a key to exit"); Console.ReadKey(); Environment.Exit(1); } }
public static void Initialize() { ServerStarted = DateTime.Now; Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(""); Console.WriteLine(@"© 2016 - 2017 SaoDev Corporation Ltd. Todos os direitos reservados ao Thiago Araujo."); Console.WriteLine(""); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine( Console.LargestWindowWidth > 30 ? @"-------------------------------------------------------------------------------------------------------------" : @""); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); _defaultEncoding = Encoding.Default; Console.Write("VERIFICANDO LICENSIA: "); string passthiago = "servidoresdabiosdevCreditosThiagoAraujoSAODevLTDHappy"; if (ExtraSettings.LICENSE != passthiago) { Console.Clear(); } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(@" ( ( ) * ) ) ( "); Console.WriteLine(@" )\ ( ( )\ ) ( ( /( ` ) /(( /(( ) ( ( )\ ( ) ( ( "); Console.WriteLine(@" (((_) )( ))\(()/( )\ )\())( ( ( )(_))\())\ ( /( )\))( ( ((((_)( )( ( /( ))\ )\ ( "); Console.WriteLine(@" )\___(()\ /((_)((_))(_)_))/ )\ )\ _ (_(_())(_)((_))(_))(_))\ )\ )\ _ )(()\ )(_))/((_)(_) )\ "); Console.WriteLine(@" ((/ __|((_)_)) _| | (_) |_ ((_)(_)_) |_ _| |(_)_)(_)_ (()(_)(_) (_)_\(_)(_)(_)_(_))( ! ((_) "); Console.WriteLine(@" | (__| '_/ -_) _` | | | _/ _ (_-<_ | | | ' \| / _` / _` / _ \ / _ \| '_/ _` | || || / _ \ "); Console.WriteLine(@" \___|_| \___\__,_| |_|\__\___/__(_) |_| |_||_|_\__,_\__, \___/ /_/ \_\_| \__,_|\_,_|/ \___/ "); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.Title = ("BIOSEMU - OPS ALGO ESTA ERRADO COM SUA LICENSIA!"); Console.Clear(); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(@" ( ( ) * ) ) ( "); Console.WriteLine(@" )\ ( ( )\ ) ( ( /( ` ) /(( /(( ) ( ( )\ ( ) ( ( "); Console.WriteLine(@" (((_) )( ))\(()/( )\ )\())( ( ( )(_))\())\ ( /( )\))( ( ((((_)( )( ( /( ))\ )\ ( "); Console.WriteLine(@" )\___(()\ /((_)((_))(_)_))/ )\ )\ _ (_(_())(_)((_))(_))(_))\ )\ )\ _ )(()\ )(_))/((_)(_) )\ "); Console.WriteLine(@" ((/ __|((_)_)) _| | (_) |_ ((_)(_)_) |_ _| |(_)_)(_)_ (()(_)(_) (_)_\(_)(_)(_)_(_))( ! ((_) "); Console.WriteLine(@" | (__| '_/ -_) _` | | | _/ _ (_-<_ | | | ' \| / _` / _` / _ \ / _ \| '_/ _` | || || / _ \ "); Console.WriteLine(@" \___|_| \___\__,_| |_|\__\___/__(_) |_| |_||_|_\__,_\__, \___/ /_/ \_\_| \__,_|\_,_|/ \___/ "); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" Licensia do emulador não é valida para o BiosEmulador, Fale com o dono do pack (Thiago Araujo)!"); Console.WriteLine(" "); Console.WriteLine(" Clique em qualquer tecla para desligar o BIOSEMU"); Console.ReadKey(); Environment.Exit(1); } Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(@" ( ) ( * ( ( ) ( "); Console.WriteLine(@" ( )\ ) ( /( )\ ) ( ` )\ ) ( )\ ) ( /( )\ ) "); Console.WriteLine(@" ( )\(()/( )\())(()/( ( )\))( ( (()/( )\ (()/( )\())(()/( "); Console.WriteLine(@" )((_)/(_))(_)\ /(_)) )\ ((_)()\ )\ /(_))(((_)( /(_))((_)\ /(_)) "); Console.WriteLine(@" ((_)_(_)) ((_)(_)) ((_)(_()((_)_ ((_)_)) )\ _ )(_))_ ((_)(_)) "); Console.WriteLine(@" | _ )_ _| / _ \/ __| | __| \/ | | | | | (_)_\(_) \ / _ \| _ \ "); Console.WriteLine(@" | _ \| | | (_) \__ \ | _|| |\/| | |_| | |__ / _ \ | |) | (_) | / "); Console.WriteLine(@" |___/___| \___/|___/ |___|_| |_|\___/|____|/_/ \_\|___/ \___/|_|_\ "); Console.WriteLine(""); Console.WriteLine(@"© 2016 - 2017 SaoDev Corporation Ltd. Todos os direitos reservados ao Thiago Araujo."); Console.WriteLine(""); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine( Console.LargestWindowWidth > 30 ? @"-------------------------------------------------------------------------------------------------------------" : @""); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Gray; Console.Title = "BIOS EMULADOR | Carregando..."; CultureInfo = CultureInfo.CreateSpecificCulture("en-GB"); try { _configuration = new ConfigurationData(Path.Combine(Application.StartupPath, @"BiosConfingThiago/ConfigBiosEmuThiago.ini")); var connectionString = new MySqlConnectionStringBuilder { ConnectionTimeout = 10, Database = GetConfig().data["db.name"], DefaultCommandTimeout = 30, Logging = false, MaximumPoolSize = uint.Parse(GetConfig().data["db.pool.maxsize"]), MinimumPoolSize = uint.Parse(GetConfig().data["db.pool.minsize"]), Password = GetConfig().data["db.password"], Pooling = true, Port = uint.Parse(GetConfig().data["db.port"]), Server = GetConfig().data["db.hostname"], UserID = GetConfig().data["db.username"], AllowZeroDateTime = true, ConvertZeroDateTime = true, }; _manager = new DatabaseManager(connectionString.ToString()); if (!_manager.IsConnected()) { log.Warn("» Existe uma conexão com o banco de dados já existente ou há um problema para se conectar a ele."); Console.ReadKey(true); Environment.Exit(1); return; } log.Info("» Conectado ao banco de dados!"); #region Add 2016 HotelName = Convert.ToString(GetConfig().data["hotel.name"]); Licenseto = Convert.ToString(GetConfig().data["license"]); #endregion Add 2016 //Reset our statistics first. using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("TRUNCATE `catalog_marketplace_data`"); dbClient.runFastQuery("UPDATE `rooms` SET `users_now` = '0' WHERE `users_now` > '0'"); dbClient.runFastQuery("UPDATE `users` SET `online` = '0' WHERE `online` = '1'"); dbClient.runFastQuery("UPDATE `server_status` SET `users_online` = '0', `loaded_rooms` = '0', `status` = '1'"); } _game = new Game(); _game.ContinueLoading(); //Have our encryption ready. HabboEncryptionV2.Initialize(new RSAKeys()); //Make sure MUS is working. _rcon = new RCONSocket(GetConfig().data["mus.tcp.bindip"], int.Parse(GetConfig().data["mus.tcp.port"]), GetConfig().data["mus.tcp.allowedaddr"].Split(Convert.ToChar(";"))); //Accept connections. _connectionManager = new ConnectionHandling(int.Parse(GetConfig().data["game.tcp.port"]), int.Parse(GetConfig().data["game.tcp.conlimit"]), int.Parse(GetConfig().data["game.tcp.conperip"]), GetConfig().data["game.tcp.enablenagles"].ToLower() == "true"); _connectionManager.Init(); //_game.StartGameLoop(); TimeSpan TimeUsed = DateTime.Now - ServerStarted; Quartovip = int.Parse(GetConfig().data["Quartovip"]); Prisao = int.Parse(GetConfig().data["Prisao"]); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; log.Info("» BIOSEMULADOR -> LISTO!! (" + TimeUsed.Seconds + " s, " + TimeUsed.Milliseconds + " ms)"); Console.ResetColor(); IsLive = true; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(""); Console.WriteLine( Console.LargestWindowWidth > 30 ? @"-------------------------------------------------------------------------------------------------------------" : @""); Console.ForegroundColor = ConsoleColor.Gray; } catch (KeyNotFoundException e) { log.ErrorFormat("Verifique o seu arquivo de configuração - alguns valores parecem estar faltando.", ConsoleColor.Red); log.Error("Pressione qualquer tecla para desligar ..."); ExceptionLogger.LogException(e); Console.ReadKey(true); Environment.Exit(1); return; } catch (InvalidOperationException e) { log.Error("Falha ao inicializar BIOS EMULADOR:" + e.Message); log.Error("Pressione qualquer tecla para desligar ..."); Console.ReadKey(true); Environment.Exit(1); return; } catch (Exception e) { log.Error("Erro fatal durante a inicialização:" + e); log.Error("Pressione uma tecla para sair"); Console.ReadKey(); Environment.Exit(1); } }