public object Deserialize(Serializer serializer, Type staticType, Stream stream) { var underlyingType = Enum.GetUnderlyingType(staticType); IStaticTypeSerializer primitiveSerializer = serializer.GetTypeData(underlyingType).TypeSerializer; return(primitiveSerializer.Deserialize(serializer, underlyingType, stream)); }
public object Deserialize(Serializer serializer, Type staticType, Stream stream) { uint lengthField; Primitives.ReadPrimitive(stream, out lengthField); if (lengthField == 0) { return(null); } else { uint length = lengthField - 1; Type elementType = staticType.GetElementType(); IStaticTypeSerializer typeSerializer = serializer.GetTypeData(elementType).TypeSerializer; var array = Array.CreateInstance(elementType, length); for (int i = 0; i < length; i++) { array.SetValue(typeSerializer.Deserialize(serializer, elementType, stream), i); } return(array); } }
public object Deserialize(Stream stream, Type type) { IStaticTypeSerializer serializer = GetTypeSerializer(type); return(serializer.Deserialize(this, type, stream)); }