Esempio n. 1
0
        public override byte[] Write()
        {
            List <byte> bytes = new List <byte>();

            bytes.AddRange(McVarint.ToBytes(ProtocolVersion));
            bytes.AddRange(McString.ToBytes(Address));
            bytes.AddRange(McUnsignedShort.ToBytes(Port));
            bytes.AddRange(McVarint.ToBytes((int)LoginState));
            return(bytes.ToArray());
        }
Esempio n. 2
0
        public override void Read(byte[] array)
        {
            McVarint.TryParse(ref array, out ProtocolVersion);

            McString.TryParse(ref array, out Address);

            McUnsignedShort.TryParse(ref array, out Port);

            McVarint.TryParse(ref array, out int loginState);
            LoginState = (LoginStates)loginState;
        }