Beispiel #1
0
        A ISubTypeSerializer <A> .ReadSubType(ref ProtoReader.State state, SubTypeState <A> value)
        {
            int field;

            value.OnBeforeDeserialize((obj, ctx) => obj.OnBeforeDeserialize());
            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 1:
                    value.Value.AVal = state.ReadInt32();
                    break;

                case 4:
                    value.ReadSubType <B>(ref state, this);
                    break;

                default:
                    state.SkipField();
                    break;
                }
            }
            value.Value.OnAfterDeserialize();
            return(value.Value);
        }
Beispiel #2
0
        C ISubTypeSerializer <C> .ReadSubType(ref ProtoReader.State state, SubTypeState <C> value)
        {
            int field;

            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 3:
                    value.Value.CVal = state.ReadInt32();
                    break;

                default:
                    state.SkipField();
                    break;
                }
            }
            return(value.Value);
        }