public void OnRecvThreadProc() { int Protocol = 0; int PacketLength = 0; byte[] mCompletePacketBuffer = null; while (GetPacket(ref Protocol, ref mCompletePacketBuffer, ref PacketLength)) { CompletePacket complete = new CompletePacket(); complete.Protocol = Protocol; complete.Length = PacketLength; complete.Data = new byte[PacketLength]; Buffer.BlockCopy(mCompletePacketBuffer, 0, complete.Data, 0, PacketLength); PacketQueue.Enqueue(complete); } }
public void OnRecvPacketProc() { int Protocol = 0; int PacketLength = 0; int compressflag = 0; byte[] mCompletePacketBuffer = null; while (GetPacket(ref Protocol, ref mCompletePacketBuffer, ref PacketLength, ref compressflag)) { if (compressflag == 1) { var byteout = CLZF2.Decompress(mCompletePacketBuffer); CompletePacket complete = new CompletePacket(); complete.Protocol = Protocol; complete.Length = byteout.Length; complete.Data = new byte[byteout.Length]; Buffer.BlockCopy(byteout, 0, complete.Data, 0, byteout.Length); PacketQueue.Enqueue(complete); } else { CompletePacket complete = new CompletePacket(); complete.Protocol = Protocol; complete.Length = PacketLength; complete.Data = new byte[PacketLength]; Buffer.BlockCopy(mCompletePacketBuffer, 0, complete.Data, 0, PacketLength); PacketQueue.Enqueue(complete); } } }