示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Resources"/> class.
        /// </summary>
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            LevelFile.Initialize();
            Fingerprint.Initialize();
            Globals.Initialize();

            if (Constants.Database == DBMS.Mongo)
            {
                Mongo.Initialize();
            }

            Resources.Redis = new Redis();
            Resources.Regex = new Regex("[ ]{2,}", RegexOptions.Compiled);

            Resources.Players = new Players();
            Resources.Clans   = new Clans();
            Resources.Chats   = new Chats();
            Resources.Battles = new Battles();
            Resources.Random  = new XorShift();

            Resources.TCPGateway = new TCPServer();
            Resources.UDPGateway = new UDPServer();

            Resources.Started = true;

            Parser.Initialize();
            EventsHandler.Initialize();
        }
示例#2
0
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            LevelFile.Initialize();
            GameEvents.Initialize();
            Globals.Initialize();
            Settings.Initialize();
            Fingerprint.Initialize();

            if (Constants.Database == DBMS.Mongo)
            {
                Mongo.Initialize();
            }

            Resources.Regex = new Regex("[ ]{2,}", RegexOptions.Compiled);
            Resources.Name  = new Regex("^[a-zA-Z0-9- ]*$");

            Resources.Processor = new Processor();

            Resources.Devices   = new Devices();
            Resources.Accounts  = new Accounts();
            Resources.Battles   = new Battles();
            Resources.Clans     = new Clans();
            Resources.Chats     = new Chats();
            Resources.Duels     = new Duels();
            Resources.Random2   = new System.Random(DateTime.UtcNow.ToString().GetHashCode());
            Resources.Random    = new XorShift();
            Resources.Gateway   = new Gateway();
            Resources.StartTime = DateTime.UtcNow;
            Resources.Timers    = new Timers();
            Resources.Started   = true;

            Parser.Initialize();
            EventsHandler.Initialize();


            Console.WriteLine("We loaded " + Factory.Messages.Count + " messages, " + Factory.Commands.Count + " commands, and " + Factory.Debugs.Count + " debug commands.\n");
#if Debug
            Resources.Test = new Test();
#endif
        }