public static int SizeStruct(int fieldIndex, IProtoStruct value) { if (value == null) { return(0); } var size = value.GetSize(); if (size == 0) { return(0); } return(GetVarint32Size(WireFormat.MakeTag(fieldIndex, WireFormat.WireType.Varint)) + GetVarint32Size((uint)size) + size); }
public void WriteStruct(int fieldIndex, IProtoStruct s) { if (s == null) { return; } var size = s.GetSize(); if (size == 0) { return; } WriteTag(fieldIndex, WireFormat.WireType.Bytes); WriteVarint32((uint)size); s.Marshal(this); }