//Protobuffer从MemoryStream进行反序列化 public bool FromMemoryStream(MemoryStream protoMS) { OneVSOneRpcGetTopReply pb = ProtoBuf.Serializer.Deserialize <OneVSOneRpcGetTopReply>(protoMS); FromPB(pb); return(true); }
//转化成Protobuffer类型函数 public OneVSOneRpcGetTopReply ToPB() { OneVSOneRpcGetTopReply v = new OneVSOneRpcGetTopReply(); v.Result = m_Result; for (int i = 0; i < (int)m_TopMesses.Count; i++) { v.TopMesses.Add(m_TopMesses[i].ToPB()); } return(v); }
//从Protobuffer类型初始化 public void FromPB(OneVSOneRpcGetTopReply v) { if (v == null) { return; } m_Result = v.Result; m_TopMesses.Clear(); for (int i = 0; i < v.TopMesses.Count; i++) { m_TopMesses.Add(new TopMessWraper()); } for (int i = 0; i < v.TopMesses.Count; i++) { m_TopMesses[i].FromPB(v.TopMesses[i]); } }