Ejemplo n.º 1
0
        private async void CreateAccountNLS()
        {
            BncsPacket pck = new BncsPacket(BncsPacketId.AuthAccountCreate, _storage.Acquire());

            _nls = new NLS(_settings.Username, _settings.Password);
            _nls.CreateAccount(pck);

            await pck.SendAsync(_connection);
        }
Ejemplo n.º 2
0
        private void CreateAccountNLS()
        {
            BncsPacket pck = new BncsPacket((byte)BncsPacketId.AuthAccountCreate);

            m_nls = new NLS(m_settings.Username, m_settings.Password);
            m_nls.CreateAccount(pck);

            Send(pck);
        }
Ejemplo n.º 3
0
        private void HandleAuthAccountLogon(ParseData data)
        {
            DataReader dr = new DataReader(data.Data);
            // 0x53
            // status codes:
            // 0: accepted, proof needed
            // 1: no such account
            // 5: upgrade account
            // else: unknown failure
            int status = dr.ReadInt32();

            if (status == 0)
            {
                byte[] salt      = dr.ReadByteArray(32);
                byte[] serverKey = dr.ReadByteArray(32);

                BncsPacket pck0x54 = new BncsPacket((byte)BncsPacketId.AuthAccountLogonProof);
                m_nls.LoginProof(pck0x54, salt, serverKey);
                Send(pck0x54);
            }
            else
            {
                // create the account or error out.
                if (status == 1)
                {
                    OnInformation(new InformationEventArgs(
                                      string.Format(CultureInfo.CurrentCulture, Strings.AccountDNECreating, m_settings.Username)));

                    BncsPacket pck0x52 = new BncsPacket((byte)BncsPacketId.AuthAccountCreate);
                    m_nls.CreateAccount(pck0x52);
                    Send(pck0x52);
                }
                else if (status == 5)
                {
                    OnError(new ErrorEventArgs(ErrorType.AccountUpgradeUnsupported, Strings.UpgradeRequestedUnsupported, true));
                    Close();
                    return;
                }
                else
                {
                    OnError(new ErrorEventArgs(ErrorType.InvalidUsernameOrPassword, Strings.InvalidUsernameOrPassword, true));
                    Close();
                    return;
                }
            }
        }