//Protobuffer从MemoryStream进行反序列化 public bool FromMemoryStream(MemoryStream protoMS) { CapsuleItemObj pb = ProtoBuf.Serializer.Deserialize <CapsuleItemObj>(protoMS); FromPB(pb); return(true); }
//从Protobuffer类型初始化 public void FromPB(CapsuleItemObj v) { if (v == null) { return; } m_ItemId = v.ItemId; m_Count = v.Count; }
//转化成Protobuffer类型函数 public CapsuleItemObj ToPB() { CapsuleItemObj v = new CapsuleItemObj(); v.ItemId = m_ItemId; v.Count = m_Count; return(v); }