Esempio n. 1
0
        private static Type GetTypeFromManifestName(Stream stream, DeserializerSession session)
        {
            var typeName = stream.ReadLengthEncodedByteArray(session);
            var hashcode = stream.ReadInt32(session);

            return(AntTypeSerializer.GetTypeFromTypeKey(new TypeKey(hashcode, typeName)));
        }
        public override object ReadValue(Stream stream, DeserializerSession session)
        {
            var typeName = stream.ReadLengthEncodedByteArray(session);

            if (typeName.Length == 0)
            {
                return(null);
            }
            var hashCode = stream.ReadInt32(session);
            var type     = AntTypeSerializer.GetTypeFromTypeKey(new TypeKey(hashCode, typeName));

            //add the deserialized type to lookup
            if (session.Serializer.Options.PreserveObjectReferences)
            {
                session.TrackDeserializedObject(type);
            }
            return(type);
        }