Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            //Console.SetWindowSize(100, 40);

            Console.Title        = "Aleeda: Habbo Hotel Emulation";
            Console.WindowWidth  = 110;
            Console.WindowHeight = 32;

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine(@"   _   _               _       ");
            Console.WriteLine(@"  /_\ | | ___  ___  __| | __ _ ");
            Console.WriteLine(@" //_\\| |/ _ \/ _ \/ _` |/ _` |");
            Console.WriteLine(@"/  _  \ |  __/  __/ (_| | (_| |");
            Console.WriteLine(@"\_/ \_/_|\___|\___|\__,_|\__,_|" + "\n");
            Console.ResetColor();

            AleedaEnvironment.Initialize();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the Ion server environment.
        /// </summary>
        public static void Initialize()
        {
            mLog.MinimumLogImportancy = LogType.Debug;
            Console.WriteLine(" [**] --> Initializing Aleeda environment.");

            DefaultEncoding = Encoding.Default;

            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);
                    AleedaEnvironment.Destroy();
                    return;
                }

                // Initialize database and test a connection by getting & releasing it
                DatabaseServer pDatabaseServer = new DatabaseServer(
                    AleedaEnvironment.Configuration["db1.server.host"],
                    AleedaEnvironment.Configuration.TryParseUInt32("db1.server.port"),
                    AleedaEnvironment.Configuration["db1.server.uid"],
                    AleedaEnvironment.Configuration["db1.server.pwd"]);

                Database pDatabase = new Database(
                    AleedaEnvironment.Configuration["db1.name"],
                    AleedaEnvironment.Configuration.TryParseUInt32("db1.minpoolsize"),
                    AleedaEnvironment.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(
                    AleedaEnvironment.Configuration.TryParseInt32("net.tcp.port"),
                    AleedaEnvironment.Configuration.TryParseInt32("net.tcp.maxcon"));
                mTcconnectionManager.GetListener().Start();


                // Try to initialize Habbo Hotel

                using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
                {
                    /*for (int i = 0; i < 10000000000; i++)
                     * {
                     *  dbClient.ExecuteQuery("INSERT INTO private_rooms (name, rating, description, ownerid, status, tags, thumbnail, petsAllowed, category, model, wallpaper, floorpaper, landscape) VALUES ('Meep','0' ,'New room!', 'Quackie', '0', '', 'HHHH', '1', '0', 'model_a', '000', '000', '0.0')");
                     * }*/
                }


                mHabboHotel = new Aleeda.HabboHotel.HabboHotel();
                mGetCache   = new HabboHotel.Cache.GetCache();

                //HabboHotel.Cache.Privilege.BootUp();

                using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE users SET online = '0'");
                    dbClient.ExecuteQuery("UPDATE users SET flat = '0'");
                }

                Console.WriteLine(" [**] --> Initialized Aleeda environment.");

                GC.Collect();
            }
            catch (Exception ex) // Catch all other exceptions
            {
                mLog.WriteError("Unhandled exception occurred during initialization of Aleeda environment. Exception message: " + ex);
            }
        }