/// <summary> /// Parse a single field from <paramref name="input"/> and merge it /// into this set. /// </summary> /// <param name="input">The coded input stream containing the field</param> /// <returns>false if the tag is an "end group" tag, true otherwise</returns> private void MergeFieldFrom(CodedInputStream input) { uint tag = input.LastTag; int number = WireFormat.GetTagFieldNumber(tag); switch (WireFormat.GetTagWireType(tag)) { case WireFormat.WireType.Varint: { ulong uint64 = input.ReadUInt64(); GetOrAddField(number).AddVarint(uint64); return; } case WireFormat.WireType.Fixed32: { uint uint32 = input.ReadFixed32(); GetOrAddField(number).AddFixed32(uint32); return; } case WireFormat.WireType.Fixed64: { ulong uint64 = input.ReadFixed64(); GetOrAddField(number).AddFixed64(uint64); return; } case WireFormat.WireType.LengthDelimited: { ByteString bytes = input.ReadBytes(); GetOrAddField(number).AddLengthDelimited(bytes); return; } case WireFormat.WireType.StartGroup: { input.SkipGroup(tag); return; } case WireFormat.WireType.EndGroup: { throw new InvalidProtocolBufferException("Merge an unknown field of end-group tag, indicating that the corresponding start-group was missing."); } default: throw new InvalidOperationException("Wire Type is invalid."); } }