Пример #1
0
        public void MergeFrom(pb::CodedInputStream input)
        {
            uint tag;

            while ((tag = input.ReadTag()) != 0)
            {
                switch (tag)
                {
                default:
                    _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                    break;

                case 10: {
                    Id = input.ReadString();
                    break;
                }

                case 18: {
                    Message = input.ReadString();
                    break;
                }

                case 25: {
                    Value = input.ReadDouble();
                    break;
                }

                case 34: {
                    ImageBytes = input.ReadBytes();
                    break;
                }

                case 42: {
                    StringOneof = input.ReadString();
                    break;
                }

                case 48: {
                    BoolOneof = input.ReadBool();
                    break;
                }

                case 58: {
                    global::Clarifai.Api.Utils.TestProto2 subBuilder = new global::Clarifai.Api.Utils.TestProto2();
                    if (oneOfFieldCase_ == OneOfFieldOneofCase.MessageOneof)
                    {
                        subBuilder.MergeFrom(MessageOneof);
                    }
                    input.ReadMessage(subBuilder);
                    MessageOneof = subBuilder;
                    break;
                }
                }
            }
        }
Пример #2
0
        public void MergeFrom(TestProto other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Id.Length != 0)
            {
                Id = other.Id;
            }
            if (other.Message.Length != 0)
            {
                Message = other.Message;
            }
            if (other.Value != 0D)
            {
                Value = other.Value;
            }
            if (other.ImageBytes.Length != 0)
            {
                ImageBytes = other.ImageBytes;
            }
            switch (other.OneOfFieldCase)
            {
            case OneOfFieldOneofCase.StringOneof:
                StringOneof = other.StringOneof;
                break;

            case OneOfFieldOneofCase.BoolOneof:
                BoolOneof = other.BoolOneof;
                break;

            case OneOfFieldOneofCase.MessageOneof:
                if (MessageOneof == null)
                {
                    MessageOneof = new global::Clarifai.Api.Utils.TestProto2();
                }
                MessageOneof.MergeFrom(other.MessageOneof);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }