Esempio n. 1
0
        protected void ModifyUserCmd(Message msg)
        {
            var emptyStr    = msg.Data[0].AsString;
            var newPassword = msg.Data[1].AsString;
            var firstName   = msg.Data[2].AsString;
            var lastName    = msg.Data[3].AsString;
            var email       = msg.Data[4].AsString;
            var language    = msg.Data[5].AsString;

            account.FirstName = firstName;
            account.LastName  = lastName;
            account.Email     = email;
            account.Language  = language;
            account.SetPassword(newPassword);
            account.UpdateStore();

            Connection.Send(msg.SuccessResponse());
            //c.Send(msg.FailResponse(new DNodeList { new DNodeBinary(1) }));
        }
Esempio n. 2
0
        protected void NewUserCmd(Message msg)
        {
            var game      = msg.Data[0].AsString; //SHOKPC1.05
            var username  = msg.Data[1].AsString;
            var password  = msg.Data[2].AsString;
            var firstName = msg.Data[3].AsString;
            var lastName  = msg.Data[4].AsString;
            var email     = msg.Data[5].AsString;
            var language  = msg.Data[6].AsString;

            if (!PlayerAccount.IsNameAvailable(username))
            {
                Connection.Send(msg.FailResponse(new DNodeList {
                    new DNodeBinary(1)
                }));
            }
            else
            {
                var pa = new PlayerAccount
                {
                    Username  = username,
                    FirstName = firstName,
                    LastName  = lastName,
                    Email     = email,
                    Language  = language
                };
                pa.SetPassword(password);
                pa.UpdateStore();

                Connection.Send(msg.SuccessResponse());
            }

            /* 1    username taken
             * 2    username not according to rules
             * 3    username contains illegal words
             * */
        }