public void InitalizeTables(
            AsyncRPGDataContext dbContext,
            Logger logger)
        {
            // Save the server constants into the DB
            ConfigQueries.InitializeConfig(
                dbContext,
                m_config.APPLICATION_VERSION,
                m_config.APPLICATION_WEB_URL,
                m_config.APPLICATION_DEBUG_WEB_URL,
                m_config.ACCOUNT_CLIENT_URL,
                m_config.WEB_SERVICE_EMAIL_ADDRESS,
                m_config.WEB_SERVICE_EMAIL_HOST,
                m_config.WEB_SERVICE_EMAIL_PORT,
                m_config.WEB_SERVICE_EMAIL_USERNAME,
                m_config.WEB_SERVICE_EMAIL_PASSWORD,
                m_config.DEFAULT_IRC_SERVER,
                m_config.DEFAULT_IRC_PORT);

            // Create test accounts
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test2",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);

            // Re-import the mob type JSON data into the DB
            {
                MobTypeImporter importer = new MobTypeImporter(logger);

                importer.ParseMobTypes(dbContext, m_config.MOBS_DIRECTORY + "/mob_types.json");
            }

            // Re-import the mob spawn tables JSON data into the DB (dependent on mob types)
            {
                MobSpawnTableImporter importer = new MobSpawnTableImporter(logger);

                importer.ParseMobSpawnTables(dbContext, m_config.MOBS_DIRECTORY + "/mob_spawn_tables.json");
            }

            // Re-import the room template XML into the DB (dependent on mob types and spawn tables)
            // This also does some import processing on the room templates (visibility, nav-mesh, etc).
            {
                RoomTemplateImporter importer = new RoomTemplateImporter(logger);

                importer.ParseRoomTemplates(dbContext, m_config.MAPS_DIRECTORY);
            }
        }
        override protected bool ProcessRequestInternal(
            RequestCache requestCache,
            out string result_code)
        {
            bool   success = true;
            string emailVerificationString = "";

            result_code = SuccessMessages.GENERAL_SUCCESS;

            // If the username contains any non-alphanumeric Characters, we can't accept it
            {
                Regex rgx = new Regex("[^a-zA-Z0-9]");

                m_username = rgx.Replace(m_username, "");
            }

            if (success &&
                m_username.Length == 0)
            {
                result_code = ErrorMessages.INVALID_USERNAME;
                success     = false;
            }

            if (success && m_password.Length == 0)
            {
                result_code = ErrorMessages.INVALID_PASSWORD;
                success     = false;
            }

            if (success &&
                !AsyncRPGSharedLib.Protocol.EMail.isWellFormedAddress(m_emailAddress))
            {
                result_code = ErrorMessages.MALFORMED_EMAIL;
                success     = false;
            }

            // Make sure the username isn't already taken
            if (success &&
                !AccountQueries.VerifyUsernameAvailable(requestCache.DatabaseContext, m_username))
            {
                result_code = ErrorMessages.RESERVED_USERNAME;
                success     = false;
            }

            if (success)
            {
                if (MailConstants.VerifyAccountEmail)
                {
                    AccountQueries.CreateAccount(
                        requestCache.DatabaseContext,
                        m_username,
                        m_password,
                        m_emailAddress,
                        out m_emailVerificationString);

                    if (AsyncRPGSharedLib.Protocol.EMail.SendVerifyAccountMessage(
                            m_emailAddress,
                            m_webServiceURL,
                            m_username,
                            emailVerificationString))
                    {
                        result_code = SuccessMessages.GENERAL_SUCCESS + "! Sending verification e-mail to " + m_emailAddress + ".";
                    }
                    else
                    {
                        result_code = ErrorMessages.SMTP_ERROR;
                        success     = false;
                    }
                }
                else
                {
                    AccountQueries.CreateAccountNoEmailVerify(
                        requestCache.DatabaseContext,
                        m_username,
                        m_password,
                        m_emailAddress,
                        DatabaseConstants.OpsLevel.player);

                    result_code = SuccessMessages.GENERAL_SUCCESS + "! Account now active (email verification off).";
                }
            }

            return(success);
        }