Ejemplo n.º 1
0
        public ObjectReader(Stream stream,
                            Serializer.ReadMethods readMethods,
                            SwapList objectsForSurrogates,
                            IDictionary <Type, Recipe> recipes,
                            Action <object> postDeserializationCallback,
                            bool treatCollectionAsUserObject,
                            VersionToleranceLevel versionToleranceLevel,
                            bool useBuffering,
                            bool disableStamping,
                            ReferencePreservation referencePreservation,
                            bool forceStampVerification)
        {
            this.readMethods = readMethods;
            this.postDeserializationCallback = postDeserializationCallback;
            this.treatCollectionAsUserObject = treatCollectionAsUserObject;
            this.referencePreservation       = referencePreservation;
            this.objectsForSurrogates        = objectsForSurrogates;
            this.recipes = recipes;

            VersionToleranceLevel = versionToleranceLevel;
            types      = new List <TypeDescriptor>();
            Methods    = new IdentifiedElementsList <MethodDescriptor>(this);
            Assemblies = new IdentifiedElementsList <AssemblyDescriptor>(this);
            Modules    = new IdentifiedElementsList <ModuleDescriptor>(this);
            HashCodeBasedWaitingValues   = new Dictionary <int, (object Dictionary, object Value)>();
            latePostDeserializationHooks = new List <Action>();

            reader = new PrimitiveReader(stream, useBuffering);
            surrogatesWhileReading = new OneToOneMap <int, object>();

            readTypeMethod         = disableStamping ? (Func <TypeDescriptor>)ReadSimpleTypeDescriptor : ReadFullTypeDescriptor;
            ForceStampVerification = forceStampVerification;
        }
        public ObjectReader(Stream stream, Serializer.ReadMethods readMethods, SwapList objectsForSurrogates = null, Action <object> postDeserializationCallback = null,
                            bool treatCollectionAsUserObject            = false,
                            VersionToleranceLevel versionToleranceLevel = 0, bool useBuffering = true, bool disableStamping = false,
                            ReferencePreservation referencePreservation = ReferencePreservation.Preserve,
                            bool forceStampVerification = false)
        {
            this.readMethods = readMethods;
            this.postDeserializationCallback = postDeserializationCallback;
            this.treatCollectionAsUserObject = treatCollectionAsUserObject;
            this.referencePreservation       = referencePreservation;
            this.objectsForSurrogates        = objectsForSurrogates ?? new SwapList();

            VersionToleranceLevel = versionToleranceLevel;
            types      = new List <TypeDescriptor>();
            Methods    = new IdentifiedElementsList <MethodDescriptor>(this);
            Assemblies = new IdentifiedElementsList <AssemblyDescriptor>(this);
            Modules    = new IdentifiedElementsList <ModuleDescriptor>(this);
            latePostDeserializationHooks = new List <Action>();

            reader = new PrimitiveReader(stream, useBuffering);
            surrogatesWhileReading = new OneToOneMap <int, object>();

            readTypeMethod         = disableStamping ? (Func <TypeDescriptor>)ReadSimpleTypeDescriptor : ReadFullTypeDescriptor;
            ForceStampVerification = forceStampVerification;
        }