using System; using System.Diagnostics; using System.Runtime.InteropServices; namespace System.Reflection { /// Discovers the attributes of an event and provides access to event metadata. // Token: 0x0200023E RID: 574 [ComVisible(true)] [ComDefaultInterface(typeof(_EventInfo))] [ClassInterface(ClassInterfaceType.None)] [Serializable] public abstract class EventInfo : MemberInfo, _EventInfo { /// Maps a set of names to a corresponding set of dispatch identifiers. /// Reserved for future use. Must be IID_NULL. /// Passed-in array of names to be mapped. /// Count of the names to be mapped. /// The locale context in which to interpret the names. /// Caller-allocated array which receives the IDs corresponding to the names. /// Late-bound access using the COM IDispatch interface is not supported. // Token: 0x06001DF6 RID: 7670 RVA: 0x000703A4 File Offset: 0x0006E5A4 void _EventInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) { throw new NotImplementedException(); } /// Retrieves the type information for an object, which can then be used to get the type information for an interface. /// The type information to return. /// The locale identifier for the type information. /// Receives a pointer to the requested type information object. /// Late-bound access using the COM IDispatch interface is not supported. // Token: 0x06001DF7 RID: 7671 RVA: 0x000703AC File Offset: 0x0006E5AC void _EventInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) { throw new NotImplementedException(); } /// Retrieves the number of type information interfaces that an object provides (either 0 or 1). /// Points to a location that receives the number of type information interfaces provided by the object. /// Late-bound access using the COM IDispatch interface is not supported. // Token: 0x06001DF8 RID: 7672 RVA: 0x000703B4 File Offset: 0x0006E5B4 void _EventInfo.GetTypeInfoCount(out uint pcTInfo) { throw new NotImplementedException(); } /// Provides access to properties and methods exposed by an object. /// Identifies the member. /// Reserved for future use. Must be IID_NULL. /// The locale context in which to interpret arguments. /// Flags describing the context of the call. /// Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays. /// Pointer to the location where the result is to be stored. /// Pointer to a structure that contains exception information. /// The index of the first argument that has an error. /// Late-bound access using the COM IDispatch interface is not supported. // Token: 0x06001DF9 RID: 7673 RVA: 0x000703BC File Offset: 0x0006E5BC void _EventInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) { throw new NotImplementedException(); } /// Gets the attributes for this event. /// The read-only attributes for this event. // Token: 0x17000565 RID: 1381 // (get) Token: 0x06001DFA RID: 7674 public abstract EventAttributes Attributes { get; } /// Gets the Type object of the underlying event-handler delegate associated with this event. /// A read-only Type object representing the delegate event handler. /// The caller does not have the required permission. // Token: 0x17000566 RID: 1382 // (get) Token: 0x06001DFB RID: 7675 RVA: 0x000703C4 File Offset: 0x0006E5C4 public Type EventHandlerType { get { MethodInfo addMethod = this.GetAddMethod(true); ParameterInfo[] parameters = addMethod.GetParameters(); if (parameters.Length > 0) { return parameters[0].ParameterType; } return null; } } /// Gets a value indicating whether the event is multicast. /// true if the delegate is an instance of a multicast delegate; otherwise, false. /// The caller does not have the required permission. // Token: 0x17000567 RID: 1383 // (get) Token: 0x06001DFC RID: 7676 RVA: 0x000703F8 File Offset: 0x0006E5F8 public bool IsMulticast { get { return true; } } /// Gets a value indicating whether the EventInfo has a name with a special meaning. /// true if this event has a special name; otherwise, false. // Token: 0x17000568 RID: 1384 // (get) Token: 0x06001DFD RID: 7677 RVA: 0x000703FC File Offset: 0x0006E5FC public bool IsSpecialName { get { return (this.Attributes & EventAttributes.SpecialName) != EventAttributes.None; } } /// Gets a value indicating that this member is an event. /// A value indicating that this member is an event. // Token: 0x17000569 RID: 1385 // (get) Token: 0x06001DFE RID: 7678 RVA: 0x00070410 File Offset: 0x0006E610 public override MemberTypes MemberType { get { return MemberTypes.Event; } } /// Adds an event handler to an event source. /// The event source. /// Encapsulates a method or methods to be invoked when the event is raised by the target. /// The event does not have a public add accessor. /// The handler that was passed in cannot be used. /// The caller does not have access permission to the member. /// The parameter is null and the event is not static.-or- The is not declared on the target. // Token: 0x06001DFF RID: 7679 RVA: 0x00070414 File Offset: 0x0006E614 [DebuggerStepThrough] [DebuggerHidden] public void AddEventHandler(object target, Delegate handler) { if (this.cached_add_event == null) { MethodInfo addMethod = this.GetAddMethod(); if (addMethod == null) { throw new InvalidOperationException("Cannot add a handler to an event that doesn't have a visible add method"); } if (addMethod.DeclaringType.IsValueType) { if (target == null && !addMethod.IsStatic) { throw new TargetException("Cannot add a handler to a non static event with a null target"); } addMethod.Invoke(target, new object[] { handler }); return; } else { this.cached_add_event = EventInfo.CreateAddEventDelegate(addMethod); } } this.cached_add_event(target, handler); } /// Returns the method used to add an event handler delegate to the event source. /// A object representing the method used to add an event handler delegate to the event source. // Token: 0x06001E00 RID: 7680 RVA: 0x0007049C File Offset: 0x0006E69C public MethodInfo GetAddMethod() { return this.GetAddMethod(false); } /// When overridden in a derived class, retrieves the MethodInfo object for the method of the event, specifying whether to return non-public methods. /// A object representing the method used to add an event handler delegate to the event source. /// true if non-public methods can be returned; otherwise, false. /// /// is true, the method used to add an event handler delegate is non-public, and the caller does not have permission to reflect on non-public methods. // Token: 0x06001E01 RID: 7681 public abstract MethodInfo GetAddMethod(bool nonPublic); /// Returns the method that is called when the event is raised. /// The method that is called when the event is raised. // Token: 0x06001E02 RID: 7682 RVA: 0x000704A8 File Offset: 0x0006E6A8 public MethodInfo GetRaiseMethod() { return this.GetRaiseMethod(false); } /// When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods. /// A MethodInfo object that was called when the event was raised. /// true if non-public methods can be returned; otherwise, false. /// /// is true, the method used to add an event handler delegate is non-public, and the caller does not have permission to reflect on non-public methods. // Token: 0x06001E03 RID: 7683 public abstract MethodInfo GetRaiseMethod(bool nonPublic); /// Returns the method used to remove an event handler delegate from the event source. /// A object representing the method used to remove an event handler delegate from the event source. // Token: 0x06001E04 RID: 7684 RVA: 0x000704B4 File Offset: 0x0006E6B4 public MethodInfo GetRemoveMethod() { return this.GetRemoveMethod(false); } /// When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event, specifying whether to return non-public methods. /// A object representing the method used to remove an event handler delegate from the event source. /// true if non-public methods can be returned; otherwise, false. /// /// is true, the method used to add an event handler delegate is non-public, and the caller does not have permission to reflect on non-public methods. // Token: 0x06001E05 RID: 7685 public abstract MethodInfo GetRemoveMethod(bool nonPublic); /// Returns the methods that have been associated with the event in metadata using the .other directive, specifying whether to include non-public methods. /// An array of objects representing methods that have been associated with an event in metadata by using the .other directive. If there are no methods matching the specification, an empty array is returned. /// true to include non-public methods; otherwise, false. /// This method is not implemented. // Token: 0x06001E06 RID: 7686 RVA: 0x000704C0 File Offset: 0x0006E6C0 public virtual MethodInfo[] GetOtherMethods(bool nonPublic) { return new MethodInfo[0]; } /// Returns the public methods that have been associated with an event in metadata using the .other directive. /// An array of objects representing the public methods that have been associated with the event in metadata by using the .other directive. If there are no such public methods, an empty array is returned. // Token: 0x06001E07 RID: 7687 RVA: 0x000704C8 File Offset: 0x0006E6C8 public MethodInfo[] GetOtherMethods() { return this.GetOtherMethods(false); } /// Removes an event handler from an event source. /// The event source. /// The delegate to be disassociated from the events raised by target. /// The event does not have a public remove accessor. /// The handler that was passed in cannot be used. /// The parameter is null and the event is not static.-or- The is not declared on the target. /// The caller does not have access permission to the member. // Token: 0x06001E08 RID: 7688 RVA: 0x000704D4 File Offset: 0x0006E6D4 [DebuggerStepThrough] [DebuggerHidden] public void RemoveEventHandler(object target, Delegate handler) { MethodInfo removeMethod = this.GetRemoveMethod(); if (removeMethod == null) { throw new InvalidOperationException("Cannot remove a handler to an event that doesn't have a visible remove method"); } removeMethod.Invoke(target, new object[] { handler }); } // Token: 0x06001E09 RID: 7689 RVA: 0x0007050C File Offset: 0x0006E70C private static void AddEventFrame(EventInfo.AddEvent addEvent, object obj, object dele) { if (obj == null) { throw new TargetException("Cannot add a handler to a non static event with a null target"); } if (!(obj is T)) { throw new TargetException("Object doesn't match target"); } addEvent((T)((object)obj), (D)((object)dele)); } // Token: 0x06001E0A RID: 7690 RVA: 0x00070548 File Offset: 0x0006E748 private static void StaticAddEventAdapterFrame(EventInfo.StaticAddEvent addEvent, object obj, object dele) { addEvent((D)((object)dele)); } // Token: 0x06001E0B RID: 7691 RVA: 0x00070558 File Offset: 0x0006E758 private static EventInfo.AddEventAdapter CreateAddEventDelegate(MethodInfo method) { Type[] array; Type type; string text; if (method.IsStatic) { array = new Type[] { method.GetParameters()[0].ParameterType }; type = typeof(EventInfo.StaticAddEvent<>); text = "StaticAddEventAdapterFrame"; } else { array = new Type[] { method.DeclaringType, method.GetParameters()[0].ParameterType }; type = typeof(EventInfo.AddEvent<, >); text = "AddEventFrame"; } Type type2 = type.MakeGenericType(array); object obj = Delegate.CreateDelegate(type2, method, false); if (obj == null) { throw new MethodAccessException(); } MethodInfo methodInfo = typeof(EventInfo).GetMethod(text, BindingFlags.Static | BindingFlags.NonPublic); methodInfo = methodInfo.MakeGenericMethod(array); return (EventInfo.AddEventAdapter)Delegate.CreateDelegate(typeof(EventInfo.AddEventAdapter), obj, methodInfo, true); } /// Returns a T:System.Type object representing the type. /// A T:System.Type object representing the type. // Token: 0x06001E0C RID: 7692 RVA: 0x00070624 File Offset: 0x0006E824 virtual Type System.Runtime.InteropServices._EventInfo.GetType() { return base.GetType(); } // Token: 0x04000A2D RID: 2605 private EventInfo.AddEventAdapter cached_add_event; // Token: 0x020006C9 RID: 1737 // (Invoke) Token: 0x060041AC RID: 16812 private delegate void AddEventAdapter(object _this, Delegate dele); // Token: 0x020006CA RID: 1738 // (Invoke) Token: 0x060041B0 RID: 16816 private delegate void AddEvent(T _this, D dele); // Token: 0x020006CB RID: 1739 // (Invoke) Token: 0x060041B4 RID: 16820 private delegate void StaticAddEvent(D dele); } }