Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            mAlive = true;
            DateTime InitStart = DateTime.Now;

            // Set up basic output, configuration, etc
            Output.InitializeStream(true, OutputLevel.DebugInformation);
            Output.WriteLine("Initializing Snowlight...");

            ConfigManager.Initialize(Constants.DataFileDirectory + "\\server-main.cfg");
            Output.SetVerbosityLevel((OutputLevel)ConfigManager.GetValue("output.verbositylevel"));

            // Load Lang
            LangManager.Initialize(Constants.LangFileDirectory + "\\lang_" + ConfigManager.GetValue("lang") + ".lang");

            // Process args
            foreach (string arg in args)
            {
                Output.WriteLine("Command line argument: " + arg);
                Input.ProcessInput(arg.Split(' '));
            }

            try
            {
                // Initialize and test database
                Output.WriteLine("Initializing MySQL manager...");
                SqlDatabaseManager.Initialize();

                // Initialize network components
                Output.WriteLine("Setting up server listener on port " + (int)ConfigManager.GetValue("net.bind.port") + "...");
                mServer = new SnowTcpListener(new IPEndPoint(IPAddress.Any, (int)ConfigManager.GetValue("net.bind.port")),
                                              (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback(
                                                  SessionManager.HandleIncomingConnection));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Output.WriteLine("Resetting database counters and statistics...");
                    PerformDatabaseCleanup(MySqlClient);

                    Output.WriteLine("Initializing game components and workers...");

                    // Core
                    DataRouter.Initialize();

                    // Sessions, characters
                    Handshake.Initialize();
                    GlobalHandler.Initialize();
                    SessionManager.Initialize();
                    CharacterInfoLoader.Initialize();
                    RightsManager.Initialize(MySqlClient);
                    SingleSignOnAuthenticator.Initialize();

                    // Room management and navigator
                    RoomManager.Initialize(MySqlClient);
                    RoomInfoLoader.Initialize();
                    RoomHandler.Initialize();
                    RoomItemHandler.Initialize();
                    Navigator.Initialize(MySqlClient);

                    // Help and moderation
                    HelpTool.Initialize(MySqlClient);
                    ModerationPresets.Initialize(MySqlClient);
                    ModerationTicketManager.Initialize(MySqlClient);
                    ModerationHandler.Initialize();
                    ModerationBanManager.Initialize(MySqlClient);

                    // Catalog, pets and items
                    ItemDefinitionManager.Initialize(MySqlClient);
                    CatalogManager.Initialize(MySqlClient);
                    CatalogPurchaseHandler.Initialize();
                    Inventory.Initialize();
                    ItemEventDispatcher.Initialize();
                    PetDataManager.Initialize(MySqlClient);

                    // Messenger
                    MessengerHandler.Initialize();

                    // Achievements and quests
                    AchievementManager.Initialize(MySqlClient);
                    QuestManager.Initialize(MySqlClient);

                    // Misc/extras
                    CrossdomainPolicy.Initialize("Data\\crossdomain.xml");
                    InfobusManager.Initialize();
                    ActivityPointsWorker.Initialize();
                    BotManager.Initialize(MySqlClient);
                    InterstitialManager.Initialize(MySqlClient);
                    ChatEmotions.Initialize();
                    EffectsCacheWorker.Initialize();
                    RecyclerManager.Initialize(MySqlClient);
                    DrinkSetManager.Initialize(MySqlClient);
                    SongManager.Initialize();
                    TradeHandler.Initialize();
                    RandomGenerator.Initialize();
                    StatisticsSyncUtil.Initialize();

                    // Polish
                    WarningSurpressors.Initialize();
                }
            }
            catch (Exception e)
            {
                HandleFatalError("Could not initialize Snowlight: " + e.Message + "\n" + e.StackTrace);
                return;
            }

            // Init complete
            TimeSpan TimeSpent = DateTime.Now - InitStart;

            Output.WriteLine("The server has initialized successfully (" + Math.Round(TimeSpent.TotalSeconds, 2) + " seconds). Ready for connections.", OutputLevel.Notification);
            Output.WriteLine((string)LangManager.GetValue("initialized.info.cmd"), OutputLevel.Notification);

            Console.Beep();
            Input.Listen(); // This will make the main thread process console while Program.Alive.
        }
Exemplo n.º 2
0
        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
                    Handshake.Initialize();
                    GlobalHandler.Initialize();
                    SessionManager.Initialize();
                    CharacterInfoLoader.Initialize();
                    RightsManager.Initialize(MySqlClient);
                    SingleSignOnAuthenticator.Initialize();

                    // Room management and navigator
                    RoomManager.Initialize(MySqlClient);
                    RoomInfoLoader.Initialize();
                    RoomHandler.Initialize();
                    RoomItemHandler.Initialize();
                    Navigator.Initialize(MySqlClient);

                    // Help and moderation
                    HelpTool.Initialize(MySqlClient);
                    ModerationPresets.Initialize(MySqlClient);
                    ModerationTicketManager.Initialize(MySqlClient);
                    ModerationHandler.Initialize();
                    ModerationBanManager.Initialize(MySqlClient);

                    // Catalog, pets and items
                    ItemDefinitionManager.Initialize(MySqlClient);
                    CatalogManager.Initialize(MySqlClient);
                    CatalogPurchaseHandler.Initialize();
                    Inventory.Initialize();
                    ItemEventDispatcher.Initialize();
                    PetDataManager.Initialize(MySqlClient);

                    // Messenger
                    MessengerHandler.Initialize();

                    // Achievements and quests
                    AchievementManager.Initialize(MySqlClient);
                    QuestManager.Initialize(MySqlClient);

                    // Misc/extras
                    CrossdomainPolicy.Initialize("Data\\crossdomain.xml");
                    InfobusManager.Initialize();
                    ActivityPointsWorker.Initialize();
                    BotManager.Initialize(MySqlClient);
                    InterstitialManager.Initialize(MySqlClient);
                    ChatEmotions.Initialize();
                    EffectsCacheWorker.Initialize();
                    RecyclerManager.Initialize(MySqlClient);
                    DrinkSetManager.Initialize(MySqlClient);
                    SongManager.Initialize();
                    TradeHandler.Initialize();
                    RandomGenerator.Initialize();
                    StatisticsSyncUtil.Initialize();
                    Wordfilter.Initialize(MySqlClient);

                    // Polish
                    WarningSurpressors.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.
        }
Exemplo n.º 3
0
Arquivo: Yupi.cs Projeto: dm5wg/Yupi
        /// <summary>
        ///     Main Void, Initializes the Emulator.
        /// </summary>
        internal static void Initialize()
        {
            Console.Title = "Yupi Emulator | Starting [...]";

            ServerStarted      = DateTime.Now;
            _defaultEncoding   = Encoding.Default;
            MutedUsersByFilter = new Dictionary <uint, uint>();

            ChatEmotions.Initialize();

            CultureInfo = CultureInfo.CreateSpecificCulture("en-GB");

            YupiRootDirectory = Directory.GetParent(Directory.GetParent(Environment.CurrentDirectory).FullName).FullName;

            YupiVariablesDirectory = Path.Combine(YupiRootDirectory, "Variables");

            try
            {
                ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/main.ini"));
                ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/Welcome/settings.ini"),
                                                 true);

                MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder
                {
                    Server                = ServerConfigurationSettings.Data["db.hostname"],
                    Port                  = uint.Parse(ServerConfigurationSettings.Data["db.port"]),
                    UserID                = ServerConfigurationSettings.Data["db.username"],
                    Password              = ServerConfigurationSettings.Data["db.password"],
                    Database              = ServerConfigurationSettings.Data["db.name"],
                    MinimumPoolSize       = uint.Parse(ServerConfigurationSettings.Data["db.pool.minsize"]),
                    MaximumPoolSize       = uint.Parse(ServerConfigurationSettings.Data["db.pool.maxsize"]),
                    Pooling               = true,
                    AllowZeroDateTime     = true,
                    ConvertZeroDateTime   = true,
                    DefaultCommandTimeout = 300u,
                    ConnectionTimeout     = 10u
                };

                Manager = new DatabaseManager(mySqlConnectionStringBuilder.ToString());

                using (IQueryAdapter commitableQueryReactor = GetDatabaseManager().GetQueryReactor())
                {
                    ConfigData = new ServerDatabaseSettings(commitableQueryReactor);
                    PetCommandHandler.Init(commitableQueryReactor);
                    PetLocale.Init(commitableQueryReactor);
                    OfflineMessages = new Dictionary <uint, List <OfflineMessage> >();
                    OfflineMessage.InitOfflineMessages(commitableQueryReactor);
                }

                ConsoleTimer       = int.Parse(ServerConfigurationSettings.Data["console.clear.time"]);
                ConsoleTimerOn     = bool.Parse(ServerConfigurationSettings.Data["console.clear.enabled"]);
                FriendRequestLimit = (uint)int.Parse(ServerConfigurationSettings.Data["client.maxrequests"]);

                LibraryParser.Incoming = new Dictionary <int, LibraryParser.StaticRequestHandler>();
                LibraryParser.Library  = new Dictionary <string, string>();
                LibraryParser.Outgoing = new Dictionary <string, int>();
                LibraryParser.Config   = new Dictionary <string, string>();

                if (ServerConfigurationSettings.Data.ContainsKey("client.build"))
                {
                    LibraryParser.ReleaseName = ServerConfigurationSettings.Data["client.build"];
                }
                else
                {
                    throw new Exception("Unable to Continue if No Release is configured to the Emulator Handle.");
                }

                LibraryParser.RegisterLibrary();
                LibraryParser.RegisterOutgoing();
                LibraryParser.RegisterIncoming();
                LibraryParser.RegisterConfig();

                Plugins = new Dictionary <string, IPlugin>();

                ICollection <IPlugin> plugins = LoadPlugins();

                if (plugins != null)
                {
                    foreach (IPlugin item in plugins.Where(item => item != null))
                    {
                        Plugins.Add(item.PluginName, item);

                        Writer.WriteLine("Loaded Plugin: " + item.PluginName + " Version: " + item.PluginVersion,
                                         "Yupi.Plugins", ConsoleColor.DarkBlue);
                    }
                }

                ServerExtraSettings.RunExtraSettings();
                FurnitureDataManager.SetCache();
                CrossDomainSettings.Set();

                _game = new Game.Game(int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"]));

                _game.GetNavigator().LoadNewPublicRooms();
                _game.ContinueLoading();

                FurnitureDataManager.Clear();

                if (ServerConfigurationSettings.Data.ContainsKey("server.lang"))
                {
                    ServerLanguage = Convert.ToString(ServerConfigurationSettings.Data["server.lang"]);
                }

                _languages = new ServerLanguageSettings(ServerLanguage);

                Writer.WriteLine("Loaded " + _languages.Count() + " Languages Vars", "Yupi.Interpreters");

                if (plugins != null)
                {
                    foreach (IPlugin itemTwo in plugins)
                    {
                        itemTwo?.message_void();
                    }
                }

                if (ConsoleTimerOn)
                {
                    Writer.WriteLine("Console Clear Timer is Enabled, with " + ConsoleTimer + " Seconds.", "Yupi.Boot");
                }

                ClientMessageFactory.Init();

                Writer.WriteLine(
                    "Game server started at port " + int.Parse(ServerConfigurationSettings.Data["game.tcp.port"]),
                    "Server.Game");

                _connectionManager = new ConnectionHandler(int.Parse(ServerConfigurationSettings.Data["game.tcp.port"]),
                                                           int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"]),
                                                           int.Parse(ServerConfigurationSettings.Data["game.tcp.conperip"]),
                                                           ServerConfigurationSettings.Data["game.tcp.antiddos"].ToLower() == "true",
                                                           ServerConfigurationSettings.Data["game.tcp.enablenagles"].ToLower() == "true");

                if (LibraryParser.Config["Crypto.Enabled"] == "true")
                {
                    Handler.Initialize(LibraryParser.Config["Crypto.RSA.N"], LibraryParser.Config["Crypto.RSA.D"],
                                       LibraryParser.Config["Crypto.RSA.E"]);

                    Writer.WriteLine("Started RSA crypto service", "Yupi.Crypto");
                }
                else
                {
                    Writer.WriteLine("The encryption system is disabled.", "Yupi.Crypto", ConsoleColor.DarkYellow);
                }

                LibraryParser.Initialize();

                if (ConsoleTimerOn)
                {
                    Timer = new Timer {
                        Interval = ConsoleTimer
                    };
                    Timer.Elapsed += TimerElapsed;
                    Timer.Start();
                }

                if (ServerConfigurationSettings.Data.ContainsKey("StaffAlert.MinLevel"))
                {
                    StaffAlertMinRank = uint.Parse(ServerConfigurationSettings.Data["StaffAlert.MinLevel"]);
                }

                if (ServerConfigurationSettings.Data.ContainsKey("game.multithread.enabled"))
                {
                    SeparatedTasksInMainLoops = ServerConfigurationSettings.Data["game.multithread.enabled"] == "true";
                }

                if (ServerConfigurationSettings.Data.ContainsKey("client.multithread.enabled"))
                {
                    SeparatedTasksInGameClientManager =
                        ServerConfigurationSettings.Data["client.multithread.enabled"] == "true";
                }

                if (ServerConfigurationSettings.Data.ContainsKey("debug.packet"))
                {
                    if (ServerConfigurationSettings.Data["debug.packet"] == "true")
                    {
                        PacketDebugMode = true;
                    }
                }

                Writer.WriteLine("Yupi Emulator ready. Status: idle", "Yupi.Boot");

                IsLive = true;
            }
            catch (Exception e)
            {
                Writer.WriteLine("Error When Starting Yupi Environment!" + Environment.NewLine + e.Message, "Yupi.Boot",
                                 ConsoleColor.Red);
                Writer.WriteLine("Please press Y to get more details or press other Key to Exit", "Yupi.Boot",
                                 ConsoleColor.Red);
                ConsoleKeyInfo key = Console.ReadKey();

                if (key.Key == ConsoleKey.Y)
                {
                    Console.WriteLine();
                    Writer.WriteLine(
                        Environment.NewLine + "[Message] Error Details: " + Environment.NewLine + e.StackTrace +
                        Environment.NewLine + e.InnerException + Environment.NewLine + e.TargetSite +
                        Environment.NewLine + "[Message] Press Any Key To Exit", "Yupi.Boot", ConsoleColor.Red);
                    Console.ReadKey();
                    Environment.Exit(1);
                }
                else
                {
                    Environment.Exit(1);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Main Void, Initializes the Emulator.
        /// </summary>
        internal static void Initialize()
        {
            Console.Title = "Yupi Emulator | Starting [...]";

            YupiServerStartDateTime = DateTime.Now;
            YupiServerTextEncoding  = Encoding.Default;
            MutedUsersByFilter      = new Dictionary <uint, uint>();

            ChatEmotions.Initialize();

            CultureInfo = CultureInfo.CreateSpecificCulture("en-GB");

            YupiRootDirectory = Directory.GetParent(Directory.GetParent(Environment.CurrentDirectory).FullName).FullName;

            YupiVariablesDirectory = Path.Combine(YupiRootDirectory, "Variables");

            try
            {
                ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/main.ini"));
                ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/Welcome/settings.ini"), true);

                if (uint.Parse(ServerConfigurationSettings.Data["db.pool.maxsize"]) > MaxRecommendedMySqlConnections)
                {
                    YupiWriterManager.WriteLine("MySQL Max Conn is High!, Recommended Value: " + MaxRecommendedMySqlConnections, "Yupi.Data", ConsoleColor.DarkYellow);
                }

                MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder
                {
                    Server                = ServerConfigurationSettings.Data["db.hostname"],
                    Port                  = uint.Parse(ServerConfigurationSettings.Data["db.port"]),
                    UserID                = ServerConfigurationSettings.Data["db.username"],
                    Password              = ServerConfigurationSettings.Data["db.password"],
                    Database              = ServerConfigurationSettings.Data["db.name"],
                    MinimumPoolSize       = uint.Parse(ServerConfigurationSettings.Data["db.pool.minsize"]),
                    MaximumPoolSize       = uint.Parse(ServerConfigurationSettings.Data["db.pool.maxsize"]),
                    Pooling               = true,
                    AllowZeroDateTime     = true,
                    ConvertZeroDateTime   = true,
                    DefaultCommandTimeout = 300,
                    ConnectionTimeout     = 10
                };

                YupiDatabaseManager = new BasicDatabaseManager(mySqlConnectionStringBuilder);

                using (IQueryAdapter queryReactor = GetDatabaseManager().GetQueryReactor())
                {
                    DatabaseSettings = new ServerDatabaseSettings(queryReactor);
                    PetCommandHandler.Init(queryReactor);
                    PetLocale.Init(queryReactor);
                    OfflineMessages = new Dictionary <uint, List <OfflineMessage> >();
                    OfflineMessage.InitOfflineMessages(queryReactor);
                }

                YupiLogManager.Init(MethodBase.GetCurrentMethod().DeclaringType);

                ConsoleCleanTimeInterval = int.Parse(ServerConfigurationSettings.Data["console.clear.time"]);
                ConsoleTimerOn           = bool.Parse(ServerConfigurationSettings.Data["console.clear.enabled"]);
                FriendRequestLimit       = (uint)int.Parse(ServerConfigurationSettings.Data["client.maxrequests"]);

                LibraryParser.Incoming = new Dictionary <int, LibraryParser.StaticRequestHandler>();
                LibraryParser.Library  = new Dictionary <string, string>();
                LibraryParser.Outgoing = new Dictionary <string, int>();
                LibraryParser.Config   = new Dictionary <string, string>();

                LibraryParser.ReleaseName = ServerConfigurationSettings.Data["client.build"];

                LibraryParser.RegisterLibrary();
                LibraryParser.RegisterOutgoing();
                LibraryParser.RegisterIncoming();
                LibraryParser.RegisterConfig();

                Plugins = new Dictionary <string, IPlugin>();

                ICollection <IPlugin> plugins = LoadPlugins();

                if (plugins != null)
                {
                    foreach (IPlugin item in plugins.Where(item => item != null))
                    {
                        Plugins.Add(item.PluginName, item);

                        YupiWriterManager.WriteLine("Loaded Plugin: " + item.PluginName + " ServerVersion: " + item.PluginVersion, "Yupi.Plugins", ConsoleColor.DarkBlue);
                    }
                }

                ServerExtraSettings.RunExtraSettings();
                FurnitureDataManager.SetCache();
                CrossDomainSettings.Set();

                GameServer = new HabboHotel(int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"]));

                GameServer.ContinueLoading();

                FurnitureDataManager.Clear();

                if (ServerConfigurationSettings.Data.ContainsKey("server.lang"))
                {
                    ServerLanguage = ServerConfigurationSettings.Data["server.lang"];
                }

                ServerLanguageVariables = new ServerLanguageSettings(ServerLanguage);

                YupiWriterManager.WriteLine("Loaded " + ServerLanguageVariables.Count() + " Languages Vars", "Yupi.Boot");

                if (plugins != null)
                {
                    foreach (IPlugin plugin in plugins)
                    {
                        plugin?.message_void();
                    }
                }

                if (ConsoleTimerOn)
                {
                    YupiWriterManager.WriteLine("Console Clear ConsoleRefreshTimer is Enabled, with " + ConsoleCleanTimeInterval + " Seconds.", "Yupi.Boot");
                }

                ClientMessageFactory.Init();

                YupiUserConnectionManager = new ConnectionHandler(int.Parse(ServerConfigurationSettings.Data["game.tcp.port"]),
                                                                  int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"]),
                                                                  int.Parse(ServerConfigurationSettings.Data["game.tcp.conperip"]),
                                                                  ServerConfigurationSettings.Data["game.tcp.antiddos"].ToLower() == "true",
                                                                  ServerConfigurationSettings.Data["game.tcp.enablenagles"].ToLower() == "true");

                YupiWriterManager.WriteLine("Server Started at Port "
                                            + ServerConfigurationSettings.Data["game.tcp.port"] + " and Address "
                                            + ServerConfigurationSettings.Data["game.tcp.bindip"], "Yupi.Boot");

                if (LibraryParser.Config["Crypto.Enabled"] == "true")
                {
                    Handler.Initialize(LibraryParser.Config["Crypto.RSA.N"], LibraryParser.Config["Crypto.RSA.D"], LibraryParser.Config["Crypto.RSA.E"]);

                    YupiWriterManager.WriteLine("Started RSA crypto service", "Yupi.Crypto");
                }
                else
                {
                    YupiWriterManager.WriteLine("The encryption system is disabled.", "Yupi.Crypto", ConsoleColor.DarkYellow);
                }

                LibraryParser.Initialize();

                if (ConsoleTimerOn)
                {
                    ConsoleRefreshTimer = new Timer {
                        Interval = ConsoleCleanTimeInterval
                    };
                    ConsoleRefreshTimer.Elapsed += ConsoleRefreshTimerElapsed;
                    ConsoleRefreshTimer.Start();
                }

                if (ServerConfigurationSettings.Data.ContainsKey("game.multithread.enabled"))
                {
                    SeparatedTasksInMainLoops = ServerConfigurationSettings.Data["game.multithread.enabled"] == "true";
                }

                if (ServerConfigurationSettings.Data.ContainsKey("client.multithread.enabled"))
                {
                    SeparatedTasksInGameClientManager = ServerConfigurationSettings.Data["client.multithread.enabled"] == "true";
                }

                if (ServerConfigurationSettings.Data.ContainsKey("debug.packet"))
                {
                    PacketDebugMode = ServerConfigurationSettings.Data["debug.packet"] == "true";
                }

                YupiWriterManager.WriteLine("Yupi Emulator ready.", "Yupi.Boot");

                IsLive = true;
            }
            catch (Exception e)
            {
                YupiWriterManager.WriteLine("Error When Starting Yupi Environment!" + Environment.NewLine + e.Message, "Yupi.Boot", ConsoleColor.Red);
                YupiWriterManager.WriteLine("Please press Y to get more details or press other Key to Exit", "Yupi.Boot", ConsoleColor.Red);

                ConsoleKeyInfo key = Console.ReadKey();

                if (key.Key == ConsoleKey.Y)
                {
                    Console.WriteLine();

                    YupiWriterManager.WriteLine(
                        Environment.NewLine + "[Message] Error Details: " + Environment.NewLine + e.StackTrace +
                        Environment.NewLine + e.InnerException + Environment.NewLine + e.TargetSite +
                        Environment.NewLine + "[Message] Press Any Key To Exit", "Yupi.Boot", ConsoleColor.Red);

                    Console.ReadKey();
                }

                Environment.Exit(1);
            }
        }