public static PacketSend Create(byte code, CodeType codeType) { var p = new PacketSend(); p._arrByte64K = ArrByte64KPool.Instance.Get(); p._arrByte64K.arrByte64K[2] = (byte)(codeType); //第2位存储 CodeType p._arrByte64K.arrByte64K[3] = (byte)(code); //第3位存储 Code return(p); }
public static PacketSend Create(PacketSend pk) { var p = new PacketSend(); p._arrByte64K = ArrByte64KPool.Instance.Get(); Array.Copy(pk._arrByte64K.arrByte64K, p._arrByte64K.arrByte64K, pk._i); p._arrByte64K.len = pk._arrByte64K.len; p._i = pk._i; return(p); }
public static ArrByte64K GetPacket(IEventData eventData) { PacketSend packetSend = PacketSend.Create(eventData.Code, PacketSend.CodeType.EventCode); if (eventData.Parameters != null) { foreach (var parameter in eventData.Parameters) { packetSend.Write((byte)parameter.Key); packetSend.Write((string)parameter.Value); } } return(packetSend.CreateArrByte64K()); }