Exemplo n.º 1
0
        private void AppendExtensionField(ProtoWriter writer)
        {
            ProtoWriter.WriteFieldHeader(this.fieldNumber, this.wireType, writer);
            WireType wireType = this.wireType;

            switch (wireType + 1)
            {
            case WireType.Fixed64:
            case WireType.String:
            case (WireType)9:
                ProtoWriter.WriteInt64(this.ReadInt64(), writer);
                return;

            case WireType.StartGroup:
                ProtoWriter.WriteBytes(ProtoReader.AppendBytes(null, this), writer);
                return;

            case WireType.EndGroup:
            {
                SubItemToken token  = ProtoReader.StartSubItem(this);
                SubItemToken token2 = ProtoWriter.StartSubItem(null, writer);
                while (this.ReadFieldHeader() > 0)
                {
                    this.AppendExtensionField(writer);
                }
                ProtoReader.EndSubItem(token, this);
                ProtoWriter.EndSubItem(token2, writer);
                return;
            }

            case (WireType)6:
                ProtoWriter.WriteInt32(this.ReadInt32(), writer);
                return;
            }
            throw this.CreateWireTypeException();
        }