예제 #1
0
        public object ReadBody(VoxBinaryReader reader)
        {
            var length = reader.ReadVariableInt();

            reader.HandleEnterInnerBuffer(length);
            try {
                var key   = thisIsTotesTheRealLegitThingReaderWriterThing.ReadThing(reader, userKeyType);
                var value = thisIsTotesTheRealLegitThingReaderWriterThing.ReadThing(reader, userValueType);
                return(Activator.CreateInstance(userKvpType, key, value));
            } finally {
                reader.HandleLeaveInnerBuffer();
            }
        }
 public T Read <T>()
 {
     slotCount--;
     if (slotCount < 0)
     {
         throw new InvalidStateException("Attempted to read past serialized slot count.");
     }
     return((T)thisIsTotesTheRealLegitThingReaderWriterThing.ReadThing(reader, typeof(T)));
 }
        public object ReadBody(VoxBinaryReader reader)
        {
            var dataLength = reader.ReadVariableInt();

            reader.HandleEnterInnerBuffer(dataLength);
            try {
                var elementCount = reader.ReadVariableInt();
                var elements     = Array.CreateInstance(elementType, elementCount);
                for (var i = 0; i < elements.Length; i++)
                {
                    var thing = thingReaderWriterDispatcherThing.ReadThing(reader, null);
                    elements.SetValue(thing, i);
                }
                return(InternalRepresentationToHintTypeConverter.ConvertCollectionToHintType(elements, userCollectionType));
            } finally {
                reader.HandleLeaveInnerBuffer();
            }
        }
예제 #4
0
 public object ReadFrame(Stream stream, Type hintType)
 {
     using (var reader = new VoxBinaryReader(stream)) {
         return(thisIsTotesTheRealLegitThingReaderWriterThing.ReadThing(reader, hintType));
     }
 }