コード例 #1
0
        /// <summary>
        /// Handles the request to create a new account.
        /// </summary>
        /// <param name="conn">Connection that the request was made on.</param>
        /// <param name="name">Name of the account.</param>
        /// <param name="password">Entered password for this account.</param>
        /// <param name="email">The email address.</param>
        public void CreateAccount(IIPSocket conn, string name, string password, string email)
        {
            if (!RequireServerRunning())
            {
                return;
            }

            ThreadAsserts.IsMainThread();

            if (conn == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("conn is null.");
                }
                return;
            }

            // Create the account
            GameMessage failReason;
            var         success = UserAccountManager.TryCreateAccount(conn, name, password, email, out failReason);

            // Send the appropriate success message
            using (var pw = ServerPacket.CreateAccount(success, failReason))
            {
                conn.Send(pw, ServerMessageType.System);
            }
        }