///TODO 把包裹内容message序列化为byte public static byte[] EncodeMessage(BeeMessage message) { using (var ms = new MemoryStream()) { var bf = new BinaryFormatter(); // todo 此处可能有错 bf.Serialize(ms, message); var valueBytes = new byte[ms.Length]; Buffer.BlockCopy(ms.GetBuffer(), 0, valueBytes, 0, (int)ms.Length); return(valueBytes); } }
public BeePacket(int opCode, int subCode, BeeMessage Message) { this.OpCode = opCode; this.SubCode = subCode; this.Message = Message; }