Inheritance: EventInfo, ISerializable
        internal static MonoEventInfo GetEventInfo(RuntimeEventInfo ev)
        {
            MonoEventInfo mei;

            get_event_info(ev, out mei);
            return(mei);
        }
Exemple #2
0
        private static EventInfo?GetBaseEventDefinition(RuntimeEventInfo evt)
        {
            MethodInfo?method = evt.GetAddMethod(true);

            if (method == null || !method.IsVirtual)
            {
                method = evt.GetRaiseMethod(true);
            }
            if (method == null || !method.IsVirtual)
            {
                method = evt.GetRemoveMethod(true);
            }
            if (method == null || !method.IsVirtual)
            {
                return(null);
            }

            MethodInfo baseMethod = ((RuntimeMethodInfo)method).GetBaseMethod();

            if (baseMethod != null && baseMethod != method)
            {
                BindingFlags flags = method.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic;
                flags |= method.IsStatic ? BindingFlags.Static : BindingFlags.Instance;

                return(baseMethod.DeclaringType !.GetEvent(evt.Name, flags));
            }
            return(null);
        }
Exemple #3
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(e, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType));
 }
Exemple #4
0
        internal override bool CacheEquals(object o)
        {
            RuntimeEventInfo runtimeEventInfo = o as RuntimeEventInfo;

            if (runtimeEventInfo == null || runtimeEventInfo.m_token != this.m_token)
            {
                return(false);
            }
            return(RuntimeTypeHandle.GetModule(this.m_declaringType).Equals((object)RuntimeTypeHandle.GetModule(runtimeEventInfo.m_declaringType)));
        }
Exemple #5
0
        internal override bool CacheEquals(object o)
        {
            RuntimeEventInfo info = o as RuntimeEventInfo;

            if (info == null)
            {
                return(false);
            }
            return((info.m_token == this.m_token) && this.m_declaringType.GetTypeHandleInternal().GetModuleHandle().Equals(info.m_declaringType.GetTypeHandleInternal().GetModuleHandle()));
        }
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray      = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            object[]    destinationArray = GetCustomAttributes(e.Module, e.MetadataToken, count, caType);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
Exemple #7
0
        internal override bool CacheEquals(object o)
        {
            RuntimeEventInfo m = o as RuntimeEventInfo;

            if ((object)m == null)
            {
                return(false);
            }

            return(m.m_token == m_token &&
                   RuntimeTypeHandle.GetModule(m_declaringType).Equals(
                       RuntimeTypeHandle.GetModule(m.m_declaringType)));
        }
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] destinationArray = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
Exemple #9
0
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] customAttributes2 = CustomAttribute.GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
Exemple #10
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

            int pcaCount = 0;
            Attribute[] pca = PseudoCustomAttribute.GetCustomAttributes(e, caType, out pcaCount);
            // Since properties and events have no transparency state, logically we should check the declaring types.
            // But then if someone wanted to apply critical attributes on a property/event he would need to make the type critical,
            // which would also implicitly made all the members critical.
            // So we check the containing assembly instead. If the assembly can contain critical code we allow critical attributes on properties/events.
            bool disallowCriticalCustomAttributes = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();
            object[] attributes = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, pcaCount, caType, disallowCriticalCustomAttributes);
            if (pcaCount > 0) Array.Copy(pca, 0, attributes, attributes.Length - pcaCount, pcaCount);
            return attributes;
        }
Exemple #11
0
 internal static Attribute[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType, out int count)
 {
     count = 0;
     return null;
 }
Exemple #12
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

            if (PseudoCustomAttribute.IsDefined(e, caType))
                return true;

            return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType);
        }
Exemple #13
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
        {
            Contract.Assert(target != null);

            return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
        }
Exemple #14
0
 internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
 {
     return(CustomAttributeData.GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken));
 }
Exemple #15
0
        internal override bool CacheEquals(object o)
        {
            RuntimeEventInfo runtimeEventInfo = o as RuntimeEventInfo;

            return(runtimeEventInfo != null && runtimeEventInfo.m_token == this.m_token && RuntimeTypeHandle.GetModule(this.m_declaringType).Equals(RuntimeTypeHandle.GetModule(runtimeEventInfo.m_declaringType)));
        }
 internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
 {
     return(CustomAttribute.GetCustomAttributesData(target));
 }
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return (PseudoCustomAttribute.IsDefined(e, caType) || IsCustomAttributeDefined(e.Module, e.MetadataToken, caType));
 }
 internal RemotingCachedData(RuntimeEventInfo ri)
 {
     this.RI = ri;
 }
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(e, caType) || IsCustomAttributeDefined(e.Module, e.MetadataToken, caType));
 }
Exemple #20
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return false;
 }
 internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
 {
     int pcaCount = 0;
     Attribute[] pca = PseudoCustomAttribute.GetCustomAttributes(e, caType, out pcaCount);
     object[] attributes = GetCustomAttributes(e.Module, e.MetadataToken, pcaCount, caType);
     if (pcaCount > 0) Array.Copy(pca, 0, attributes, attributes.Length - pcaCount, pcaCount);
     return attributes;
 }
        internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
        {
            ASSERT.PRECONDITION(e != null);

            if (PseudoCustomAttribute.IsDefined(e, caType))
                return true;

            return IsCustomAttributeDefined(e.Module, e.MetadataToken, caType);
        }
Exemple #23
0
 // Token: 0x06004492 RID: 17554 RVA: 0x000FC7F7 File Offset: 0x000FA9F7
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return(false);
 }
Exemple #24
0
 // Token: 0x06004491 RID: 17553 RVA: 0x000FC7F1 File Offset: 0x000FA9F1
 internal static Attribute[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType, out int count)
 {
     count = 0;
     return(null);
 }
 internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
 {
     return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
 }
 internal static extern int get_metadata_token(RuntimeEventInfo monoEvent);
        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && caType != null)
            {
                FrameworkEventSource.Log.QueryAttributeIsDefined(caType.GetFullNameForEtw());
            }
#endif

            if (PseudoCustomAttribute.IsDefined(e, caType))
                return true;

            return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType);
        }
 internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
 {
     int count = 0;
     Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
     bool isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();
     object[] destinationArray = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
     if (count > 0)
     {
         Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
     }
     return destinationArray;
 }
 static extern void get_event_info(RuntimeEventInfo ev, out MonoEventInfo info);
 internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
 {
     int count = 0;
     Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
     object[] destinationArray = GetCustomAttributes(e.Module, e.MetadataToken, count, caType);
     if (count > 0)
     {
         Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
     }
     return destinationArray;
 }
Exemple #31
0
		RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
		{
			var refh = new RuntimeTypeHandle (reflectedType);
			using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (name, bindingAttr))) {
				int n = h.Length;
				var a = new RuntimeEventInfo[n];
				for (int i = 0; i < n; i++) {
					var eh = new Mono.RuntimeEventHandle (h[i]);
					a[i] = (RuntimeEventInfo) EventInfo.GetEventFromHandle (eh, refh);
				}
				return a;
			}
		}
 } // RemotingCachedData
 internal RemotingCachedData(RuntimeEventInfo ri) 
 { 
     RI = ri;
 } // RemotingCachedData