예제 #1
0
        private void HandlePinValidation(IUnsafePacketReader reader)
        {
            // TODO: Configuring the server to not require PINs.

            var action = reader.ReadByte <PinRequestType>();

            reader.Skip(5);

            switch (action)
            {
            case PinRequestType.PinNotSet:
                State = AuthClientState.AskPin;

                ServerSession.WritePacket(SetPinResponse());
                break;

            case PinRequestType.CheckPin:
                if (CheckPin(reader))
                {
                    State = AuthClientState.LoggedIn;

                    ServerSession.WritePacket(PinAcceptedResponse());
                }
                else
                {
                    ServerSession.WritePacket(InvalidPinResponse());
                }
                break;

            case PinRequestType.AssignPin:
                if (CheckPin(reader))
                {
                    State = AuthClientState.LoggedIn;

                    ServerSession.WritePacket(SetPinResponse());
                }
                else
                {
                    ServerSession.WritePacket(InvalidPinResponse());
                }
                break;
            }
        }
예제 #2
0
        private void HandlePinValidation(IUnsafePacketReader reader)
        {
            // TODO: Configuring the server to not require PINs.

            var action = reader.ReadByte<PinRequestType>();

            reader.Skip(5);

            switch (action)
            {
                case PinRequestType.PinNotSet:
                    this.State = AuthClientState.AskPin;

                    this.ServerSession.WritePacket(this.SetPinResponse());
                    break;

                case PinRequestType.CheckPin:
                    if (this.CheckPin(reader))
                    {
                        this.State = AuthClientState.LoggedIn;

                        this.ServerSession.WritePacket(this.PinAcceptedResponse());
                    }
                    else
                    {
                        this.ServerSession.WritePacket(this.InvalidPinResponse());
                    }
                    break;

                case PinRequestType.AssignPin:
                    if (this.CheckPin(reader))
                    {
                        this.State = AuthClientState.LoggedIn;

                        this.ServerSession.WritePacket(this.SetPinResponse());
                    }
                    else
                    {
                        this.ServerSession.WritePacket(this.InvalidPinResponse());
                    }
                    break;
            }
        }
예제 #3
0
 private static int FailingReturningRead(IUnsafePacketReader reader)
 {
     reader.Skip(reader.Remaining - 1);
     return reader.ReadInt32();
 }
예제 #4
0
 private static int FailingReturningRead(IUnsafePacketReader reader)
 {
     reader.Skip(reader.Remaining - 1);
     return(reader.ReadInt32());
 }
예제 #5
0
 private static void FailingRead(IUnsafePacketReader reader)
 {
     reader.Skip(reader.Remaining - 1);
     reader.ReadInt32();
 }