/// <summary> /// Initializes the Ion server environment. /// </summary> public static void Initialize() { mLog.MinimumLogImportancy = LogType.Debug; mLog.WriteLine("Initializing Ion environment."); try { // Try to initialize configuration try { mConfig = ConfigurationModule.LoadFromFile("settings.ini"); } catch (FileNotFoundException ex) { mLog.WriteError("Failed to load configuration file, exception message was: " + ex.Message); IonEnvironment.Destroy(); return; } // Initialize database and test a connection by getting & releasing it DatabaseServer pDatabaseServer = new DatabaseServer( IonEnvironment.Configuration["db1.server.host"], IonEnvironment.Configuration.TryParseUInt32("db1.server.port"), IonEnvironment.Configuration["db1.server.uid"], IonEnvironment.Configuration["db1.server.pwd"]); Database pDatabase = new Database( IonEnvironment.Configuration["db1.name"], IonEnvironment.Configuration.TryParseUInt32("db1.minpoolsize"), IonEnvironment.Configuration.TryParseUInt32("db1.maxpoolsize")); mDatabaseManager = new DatabaseManager(pDatabaseServer, pDatabase); mDatabaseManager.SetClientAmount(2); mDatabaseManager.ReleaseClient(mDatabaseManager.GetClient().Handle); mDatabaseManager.StartMonitor(); // Initialize TCP listener mTcconnectionManager = new IonTcpConnectionManager( IonEnvironment.Configuration["net.tcp.localip"], IonEnvironment.Configuration.TryParseInt32("net.tcp.port"), IonEnvironment.Configuration.TryParseInt32("net.tcp.maxcon")); mTcconnectionManager.GetListener().Start(); // Try to initialize Habbo Hotel mHabboHotel = new Ion.HabboHotel.HabboHotel(); IonEnvironment.GetLog().WriteLine("Initialized Ion environment."); } catch (Exception ex) // Catch all other exceptions { mLog.WriteError("Unhandled exception occurred during initialization of Ion environment. Exception message: " + ex.Message); } }
/// <summary> /// Initializes the Ion server environment. /// </summary> public static void Initialize() { mLog.MinimumLogImportancy = LogType.Debug; mLog.WriteLine("Initializing Ion environment."); try { // Try to initialize configuration try { mConfig = ConfigurationModule.LoadFromFile("settings"); } catch (FileNotFoundException ex) { mLog.WriteError("Failed to load configuration file, exception message was: " + ex.Message); IonEnvironment.Destroy(); return; } // Initialize database and test a connection by getting & releasing it DatabaseServer pDatabaseServer = new DatabaseServer( IonEnvironment.Configuration["db1.server.host"], IonEnvironment.Configuration.TryParseUInt32("db1.server.port"), IonEnvironment.Configuration["db1.server.uid"], IonEnvironment.Configuration["db1.server.pwd"]); Database pDatabase = new Database( IonEnvironment.Configuration["db1.name"], IonEnvironment.Configuration.TryParseUInt32("db1.minpoolsize"), IonEnvironment.Configuration.TryParseUInt32("db1.maxpoolsize")); mDatabaseManager = new DatabaseManager(pDatabaseServer, pDatabase); mDatabaseManager.SetClientAmount(2); mDatabaseManager.ReleaseClient(mDatabaseManager.GetClient().Handle); mDatabaseManager.StartMonitor(); // Initialize TCP listener mTcconnectionManager = new IonTcpConnectionManager( IonEnvironment.Configuration["net.tcp.localip"], IonEnvironment.Configuration.TryParseInt32("net.tcp.port"), IonEnvironment.Configuration.TryParseInt32("net.tcp.maxcon")); mTcconnectionManager.GetListener().Start(); // Try to initialize Habbo Hotel mHabboHotel = new Ion.HabboHotel.HabboHotel(); IonEnvironment.GetLog().WriteLine("Initialized Ion environment."); } catch (Exception ex) // Catch all other exceptions { mLog.WriteError("Unhandled exception occurred during initialization of Ion environment. Exception message: " + ex.Message); } }