示例#1
0
 internal SerializationEventHandler AddOnSerialized(object obj, SerializationEventHandler handler)
 {
     if (this.m_OnSerializedMethods != null)
     {
         foreach (MethodInfo info in this.m_OnSerializedMethods)
         {
             SerializationEventHandler b = (SerializationEventHandler)Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, info);
             handler = (SerializationEventHandler)Delegate.Combine(handler, b);
         }
     }
     return(handler);
 }
 internal SerializationEventHandler AddOnSerialized(object obj, SerializationEventHandler handler)
 {
     if (this.m_OnSerializedMethods != null)
     {
         foreach (MethodInfo info in this.m_OnSerializedMethods)
         {
             SerializationEventHandler b = (SerializationEventHandler) Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, info);
             handler = (SerializationEventHandler) Delegate.Combine(handler, b);
         }
     }
     return handler;
 }
示例#3
0
 internal SerializationEventHandler AddOnDeserialized(object obj, SerializationEventHandler handler)
 {
     if (this.m_OnDeserializedMethods != null)
     {
         foreach (MethodInfo deserializedMethod in this.m_OnDeserializedMethods)
         {
             SerializationEventHandler serializationEventHandler = (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, deserializedMethod);
             handler += serializationEventHandler;
         }
     }
     return(handler);
 }
示例#4
0
 /// <summary>Add all methods to a delegate.</summary>
 private static SerializationEventHandler?AddOnDelegate(object obj, SerializationEventHandler?handler, List <MethodInfo>?methods)
 {
     if (methods != null)
     {
         foreach (MethodInfo m in methods)
         {
             SerializationEventHandler onDeserialized = m.CreateDelegate <SerializationEventHandler>(obj);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onDeserialized);
         }
     }
     return(handler);
 }
 /// <summary>Add all methods to a delegate.</summary>
 private static SerializationEventHandler AddOnDelegate(object obj, SerializationEventHandler handler, List<MethodInfo> methods)
 {
     if (methods != null)
     {
         foreach (MethodInfo m in methods)
         {
             SerializationEventHandler onDeserialized = (SerializationEventHandler)m.CreateDelegate(typeof(SerializationEventHandler), obj);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onDeserialized);
         }
     }
     return handler;
 }
示例#6
0
 internal void InvokeOnSerializing(object obj, StreamingContext context)
 {
     if (this.m_OnSerializingMethods != null)
     {
         SerializationEventHandler a = null;
         foreach (MethodInfo info in this.m_OnSerializingMethods)
         {
             SerializationEventHandler b = (SerializationEventHandler)Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, info);
             a = (SerializationEventHandler)Delegate.Combine(a, b);
         }
         a(context);
     }
 }
 internal SerializationEventHandler AddOnSerialized(Object obj, SerializationEventHandler handler)
 {
     // Add all OnSerialized methods to a delegate
     if (m_OnSerializedMethods != null)
     {
         foreach (MethodInfo m in m_OnSerializedMethods)
         {
             SerializationEventHandler onSerialized =
                 (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onSerialized);
         }
     }
     return(handler);
 }
 internal SerializationEventHandler AddOnDeserialized(Object obj, SerializationEventHandler handler)
 {
     // Add all OnDeserialized methods to a delegate
     if (m_OnDeserializedMethods != null)
     {
         foreach (MethodInfo m in m_OnDeserializedMethods)
         {
             SerializationEventHandler onDeserialized =
                 (SerializationEventHandler)Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onDeserialized);
         }
     }
     return(handler);
 }
示例#9
0
        internal void InvokeOnDeserialized(object obj, StreamingContext context)
        {
            if (this.m_OnDeserializedMethods == null)
            {
                return;
            }
            new object[1][0] = (object)context;
            SerializationEventHandler serializationEventHandler1 = (SerializationEventHandler)null;

            foreach (MethodInfo deserializedMethod in this.m_OnDeserializedMethods)
            {
                SerializationEventHandler serializationEventHandler2 = (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, deserializedMethod);
                serializationEventHandler1 += serializationEventHandler2;
            }
            serializationEventHandler1(context);
        }
 internal void InvokeOnSerializing(Object obj, StreamingContext context)
 {
     Contract.Assert(obj != null, "object should have been initialized");
     // Invoke all OnSerializingMethods
     if (m_OnSerializingMethods != null)
     {
         Object[] p = new Object[] { context };
         SerializationEventHandler handler = null;
         foreach (MethodInfo m in m_OnSerializingMethods)
         {
             SerializationEventHandler onSerializing =
                 (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onSerializing);
         }
         handler(context);
     }
 }
 internal void InvokeOnDeserialized(Object obj, StreamingContext context)
 {
     BCLDebug.Assert(obj != null, "object should have been initialized");
     // Invoke all OnDeserializingMethods
     if (m_OnDeserializedMethods != null)
     {
         Object[] p = new Object[] { context };
         SerializationEventHandler handler = null;
         foreach (MethodInfo m in m_OnDeserializedMethods)
         {
             SerializationEventHandler onDeserialized =
                 (SerializationEventHandler)Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onDeserialized);
         }
         handler(context);
     }
 }
 internal void InvokeOnDeserialized(object obj, StreamingContext context)
 {
     if (this.m_OnDeserializedMethods != null)
     {
         object[] array = new object[]
         {
             context
         };
         SerializationEventHandler serializationEventHandler = null;
         foreach (MethodInfo method in this.m_OnDeserializedMethods)
         {
             SerializationEventHandler b = (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, method);
             serializationEventHandler = (SerializationEventHandler)Delegate.Combine(serializationEventHandler, b);
         }
         serializationEventHandler(context);
     }
 }
示例#13
0
 internal SerializationEventHandler AddOnDeserialized(Object obj, SerializationEventHandler handler)
 {
     // Add all OnDeserialized methods to a delegate
     if (m_OnDeserializedMethods != null)
     {
         foreach(MethodInfo m in m_OnDeserializedMethods)
         {
             SerializationEventHandler onDeserialized =
                 (SerializationEventHandler)Delegate.CreateDelegateNoSecurityCheck((RuntimeType)typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onDeserialized);
         }
     }
     return handler;
 }
 internal SerializationEventHandler AddOnSerialized(Object obj, SerializationEventHandler handler)
 {
     // Add all OnSerialized methods to a delegate
     if (m_OnSerializedMethods != null)
     {
         foreach(MethodInfo m in m_OnSerializedMethods)
         {
             SerializationEventHandler onSerialized = 
                 (SerializationEventHandler)Delegate.InternalCreateDelegate(typeof(SerializationEventHandler), obj, m);
             handler = (SerializationEventHandler)Delegate.Combine(handler, onSerialized);
         }
     }
     return handler;
 }
 internal virtual void AddOnDeserialized(object obj)
 {
     this.m_onDeserializedHandler = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()).AddOnDeserialized(obj, this.m_onDeserializedHandler);
 }
 private void AddOnSerialized(object obj)
 {
     this.m_onSerializedHandler = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()).AddOnSerialized(obj, this.m_onSerializedHandler);
 }
示例#17
0
 private void AddOnSerialized(object obj)
 {
     this.m_onSerializedHandler = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()).AddOnSerialized(obj, this.m_onSerializedHandler);
 }
示例#18
0
        private void AddOnSerialized(object obj)
        {
            SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            _onSerializedHandler = cache.AddOnSerialized(obj, _onSerializedHandler);
        }
 private void AddOnSerialized(Object obj)
 { 
     SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()); 
     m_onSerializedHandler = cache.AddOnSerialized(obj, m_onSerializedHandler);
 } 
 internal SerializationEventHandler AddOnDeserialized(object obj, SerializationEventHandler handler) =>
     AddOnDelegate(obj, handler, _onDeserializedMethods);
示例#21
0
 internal virtual void AddOnDeserialized(object obj)
 {
     this.m_onDeserializedHandler = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()).AddOnDeserialized(obj, this.m_onDeserializedHandler);
 }
 internal virtual void AddOnDeserialized(Object obj) 
 { 
     SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());
     m_onDeserializedHandler = cache.AddOnDeserialized(obj, m_onDeserializedHandler); 
 }
 internal SerializationEventHandler AddOnDeserialized(object obj, SerializationEventHandler handler) =>
 AddOnDelegate(obj, handler, _onDeserializedMethods);