예제 #1
0
        public T Deserialize <T>(BinaryReader reader)
            where T : IPortableObject
        {
            var dataLength = reader.ReadInt32();
            var data       = reader.ReadBytes(dataLength);
            var pofReader  = new PofReader(context, SlotSourceFactory.CreateWithSingleSlot(data));

            return(pofReader.ReadObject <T>(0));
        }
예제 #2
0
 private T ReadObjectHelper <T>(Type type, BinaryReader reader)
 {
     if (context.IsReservedType(type))
     {
         return((T)ReadReservedType(type, reader));
     }
     else
     {
         var instance = (IPortableObject)Activator.CreateInstance(type);
         instance.Deserialize(new PofReader(context, SlotSourceFactory.CreateFromBinaryReader(reader)));
         return((T)instance);
     }
 }