Exemple #1
0
 private void OnDeserialized(StreamingContext context)
 {
     if (this.m_realObject != null)
     {
         SerializationEventsCache.GetSerializationEventsForType(this.m_realObject.GetType()).InvokeOnDeserialized(this.m_realObject, context);
         this.m_realObject = null;
     }
 }
Exemple #2
0
        public void RegisterObject(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            if (serializationEventsForType.HasOnSerializingEvents && this.m_objectSeenTable[obj] == null)
            {
                this.m_objectSeenTable[obj] = true;
                serializationEventsForType.InvokeOnSerializing(obj, this.m_context);
                this.AddOnSerialized(obj);
            }
        }
Exemple #3
0
 private void OnDeserialized(StreamingContext context)
 {
     // We only need to complete deserialization if we were hooking the deserialization process.  If
     // we have not deserialized an object in the GetRealObject call, then there's nothing more for
     // us to do here.
     if (m_realObject != null)
     {
         // Fire the real object's OnDeserialized method if they registered one.  Since we replaced
         // ourselves as the target of the deserialization, OnDeserialized on the target won't
         // automatically get triggered unless we do it manually.
         SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(m_realObject.GetType());
         cache.InvokeOnDeserialized(m_realObject, context);
         m_realObject = null;
     }
 }
        public void RegisterObject(object obj)
        {
            // Invoke OnSerializing for this object
            SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            // Check to make sure type has serializing events
            if (cache.HasOnSerializingEvents)
            {
                // Check to see if we have invoked the events on the object
                if (_objectSeenTable.TryAdd(obj, true))
                {
                    // Invoke the events
                    cache.InvokeOnSerializing(obj, _context);
                    // Register for OnSerialized event
                    AddOnSerialized(obj);
                }
            }
        }
        private void AddOnSerialized(object obj)
        {
            SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            _onSerializedHandler = cache.AddOnSerialized(obj, _onSerializedHandler);
        }
        /// <summary>Invokes the method marked with the <see cref="T:System.Runtime.Serialization.OnDeserializingAttribute" />.</summary>
        /// <param name="obj">The instance of the type that contains the method to be invoked.</param>
        // Token: 0x06005168 RID: 20840 RVA: 0x0011DB4C File Offset: 0x0011BD4C
        public void RaiseOnDeserializingEvent(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            serializationEventsForType.InvokeOnDeserializing(obj, this.m_context);
        }
        // Token: 0x06005167 RID: 20839 RVA: 0x0011DB24 File Offset: 0x0011BD24
        internal virtual void RaiseOnDeserializedEvent(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            serializationEventsForType.InvokeOnDeserialized(obj, this.m_context);
        }
        internal virtual void AddOnDeserialized(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            this.m_onDeserializedHandler = serializationEventsForType.AddOnDeserialized(obj, this.m_onDeserializedHandler);
        }
Exemple #9
0
        private void AddOnSerialized(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            this.m_onSerializedHandler = serializationEventsForType.AddOnSerialized(obj, this.m_onSerializedHandler);
        }