public static void Encode(List <byte> packetData, PKTReqLogin packet) { packetData.AddRange(BitConverter.GetBytes(packet.IDLength)); PacketEnDecodeUtil.StringTo(packet.ID, packetData); packetData.AddRange(BitConverter.GetBytes(packet.PWLength)); PacketEnDecodeUtil.StringTo(packet.PW, packetData); }
public static bool Decode(byte[] packetData, ref PKTArrayTest1 packet) { int readPos = 0; packet.Count = BitConverter.ToInt16(packetData, readPos); readPos += 2; PacketEnDecodeUtil.ToCollection(packetData, ref readPos, packet.Count, packet.ValueList); return(true); }
public static bool Decode(byte[] packetData, ref PKTReqLogin packet) { int readPos = 0; packet.IDLength = BitConverter.ToInt16(packetData, readPos); readPos += 2; PacketEnDecodeUtil.ToString(packetData, ref readPos, ref packet.ID); packet.PWLength = BitConverter.ToInt16(packetData, readPos); readPos += 2; PacketEnDecodeUtil.ToString(packetData, ref readPos, ref packet.PW); return(true); }
public static void Encode(List <byte> packetData, PKTArrayTest1 packet) { packetData.AddRange(BitConverter.GetBytes(packet.Count)); PacketEnDecodeUtil.ArrayTo(packet.ValueList, packetData); }