private static ActiveCodeReq Read(ActiveCodeReq acReq, ProtoReader protoReader) { int fieldNum; while ((fieldNum = protoReader.ReadFieldHeader()) > 0) { if (fieldNum != 1) { if (fieldNum != 2) { if (acReq == null) { ActiveCodeReq activeCodeReq = new ActiveCodeReq(); ProtoReader.NoteObject(activeCodeReq, protoReader); acReq = activeCodeReq; } protoReader.AppendExtensionData(acReq); } else { if (acReq == null) { ActiveCodeReq activeCodeReq = new ActiveCodeReq(); ProtoReader.NoteObject(activeCodeReq, protoReader); acReq = activeCodeReq; } string activeCode = protoReader.ReadString(); if (activeCode != null) { acReq.ActiveCode = activeCode; } } } else { if (acReq == null) { ActiveCodeReq activeCodeReq = new ActiveCodeReq(); ProtoReader.NoteObject(activeCodeReq, protoReader); acReq = activeCodeReq; } long accountId = protoReader.ReadInt64(); acReq.AccountId = accountId; } } if (acReq == null) { ActiveCodeReq activeCodeReq = new ActiveCodeReq(); ProtoReader.NoteObject(activeCodeReq, protoReader); acReq = activeCodeReq; } return(acReq); }
private static void Write(ActiveCodeReq activeCodeReq, ProtoWriter protoWrite) { long accountId = activeCodeReq.AccountId; if (accountId != 0) { // Variant可变的 ProtoWriter.WriteFieldHeader(1, WireType.Variant, protoWrite); ProtoWriter.WriteInt64(accountId, protoWrite); } string activeCode = activeCodeReq.ActiveCode; if (!string.IsNullOrEmpty(activeCode)) { ProtoWriter.WriteFieldHeader(2, WireType.String, protoWrite); ProtoWriter.WriteString(activeCode, protoWrite); } ProtoWriter.AppendExtensionData(activeCodeReq, protoWrite); }