Пример #1
0
    public void MergeFrom(CounterEvent other)
    {
        if (other == null)
        {
            return;
        }
        if (other.Id.Length != 0)
        {
            Id = other.Id;
        }
        if (other.Version != 0UL)
        {
            Version = other.Version;
        }
        switch (other.EventCase)
        {
        case EventOneofCase.Added:
            if (Added == null)
            {
                Added = new global::CounterAdded();
            }
            Added.MergeFrom(other.Added);
            break;

        case EventOneofCase.Decremented:
            if (Decremented == null)
            {
                Decremented = new global::CounterDecremented();
            }
            Decremented.MergeFrom(other.Decremented);
            break;

        case EventOneofCase.Incremented:
            if (Incremented == null)
            {
                Incremented = new global::CounterIncremented();
            }
            Incremented.MergeFrom(other.Incremented);
            break;

        case EventOneofCase.NameChanged:
            if (NameChanged == null)
            {
                NameChanged = new global::CounterNameChanged();
            }
            NameChanged.MergeFrom(other.NameChanged);
            break;

        case EventOneofCase.Removed:
            if (Removed == null)
            {
                Removed = new global::CounterRemoved();
            }
            Removed.MergeFrom(other.Removed);
            break;
        }

        _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }
Пример #2
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.ReadBytes();
                break;
            }

            case 16: {
                Version = input.ReadUInt64();
                break;
            }

            case 26: {
                global::CounterAdded subBuilder = new global::CounterAdded();
                if (eventCase_ == EventOneofCase.Added)
                {
                    subBuilder.MergeFrom(Added);
                }
                input.ReadMessage(subBuilder);
                Added = subBuilder;
                break;
            }

            case 34: {
                global::CounterDecremented subBuilder = new global::CounterDecremented();
                if (eventCase_ == EventOneofCase.Decremented)
                {
                    subBuilder.MergeFrom(Decremented);
                }
                input.ReadMessage(subBuilder);
                Decremented = subBuilder;
                break;
            }

            case 42: {
                global::CounterIncremented subBuilder = new global::CounterIncremented();
                if (eventCase_ == EventOneofCase.Incremented)
                {
                    subBuilder.MergeFrom(Incremented);
                }
                input.ReadMessage(subBuilder);
                Incremented = subBuilder;
                break;
            }

            case 50: {
                global::CounterNameChanged subBuilder = new global::CounterNameChanged();
                if (eventCase_ == EventOneofCase.NameChanged)
                {
                    subBuilder.MergeFrom(NameChanged);
                }
                input.ReadMessage(subBuilder);
                NameChanged = subBuilder;
                break;
            }

            case 58: {
                global::CounterRemoved subBuilder = new global::CounterRemoved();
                if (eventCase_ == EventOneofCase.Removed)
                {
                    subBuilder.MergeFrom(Removed);
                }
                input.ReadMessage(subBuilder);
                Removed = subBuilder;
                break;
            }
            }
        }
    }