示例#1
0
            public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry)
            {
                PrepareBuilder();
                pb::UnknownFieldSet.Builder unknownFields = null;
                uint   tag;
                string field_name;

                while (input.ReadTag(out tag, out field_name))
                {
                    if (tag == 0 && field_name != null)
                    {
                        int field_ordinal = global::System.Array.BinarySearch(_upRevisionFieldNames, field_name, global::System.StringComparer.Ordinal);
                        if (field_ordinal >= 0)
                        {
                            tag = _upRevisionFieldTags[field_ordinal];
                        }
                        else
                        {
                            if (unknownFields == null)
                            {
                                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                            }
                            ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                            continue;
                        }
                    }
                    switch (tag)
                    {
                    case 0: {
                        throw pb::InvalidProtocolBufferException.InvalidTag();
                    }

                    default: {
                        if (pb::WireFormat.IsEndGroupTag(tag))
                        {
                            if (unknownFields != null)
                            {
                                this.UnknownFields = unknownFields.Build();
                            }
                            return(this);
                        }
                        if (unknownFields == null)
                        {
                            unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                        }
                        ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                        break;
                    }

                    case 8: {
                        object unknown;
                        if (input.ReadEnum(ref result.value_, out unknown))
                        {
                            result.hasValue = true;
                        }
                        else if (unknown is int)
                        {
                            if (unknownFields == null)
                            {
                                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                            }
                            unknownFields.MergeVarintField(1, (ulong)(int)unknown);
                        }
                        break;
                    }

                    case 18:
                    case 16: {
                        scg::ICollection <object> unknownItems;
                        input.ReadEnumArray <global::Google.ProtocolBuffers.TestProtos.UpRevision.Types.Enum>(tag, field_name, result.values_, out unknownItems);
                        if (unknownItems != null)
                        {
                            if (unknownFields == null)
                            {
                                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                            }
                            foreach (object rawValue in unknownItems)
                            {
                                if (rawValue is int)
                                {
                                    unknownFields.MergeVarintField(2, (ulong)(int)rawValue);
                                }
                            }
                        }
                        break;
                    }
                    }
                }

                if (unknownFields != null)
                {
                    this.UnknownFields = unknownFields.Build();
                }
                return(this);
            }