New test.
[mono.git] / mcs / class / corlib / System.Reflection / MonoEvent.cs
old mode 100755 (executable)
new mode 100644 (file)
index 927c55b..95b25b0
@@ -45,6 +45,7 @@ namespace System.Reflection {
                public MethodInfo remove_method;
                public MethodInfo raise_method;
                public EventAttributes attrs;
+               public MethodInfo[] other_methods;
                
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal static extern void get_event_info (MonoEvent ev, out MonoEventInfo info);
@@ -66,23 +67,39 @@ namespace System.Reflection {
                public override MethodInfo GetAddMethod(bool nonPublic) {
                        MonoEventInfo info;
                        MonoEventInfo.get_event_info (this, out info);
-                               
-                       return info.add_method;
+                       
+                       
+                       if (nonPublic || (info.add_method != null && info.add_method.IsPublic))
+                               return info.add_method;
+                       return null;
                }
 
                public override MethodInfo GetRaiseMethod( bool nonPublic) {
                        MonoEventInfo info;
                        MonoEventInfo.get_event_info (this, out info);
                                
-                       return info.raise_method;
+                       if (nonPublic || (info.raise_method != null && info.raise_method.IsPublic))
+                               return info.raise_method;
+                       return null;
                }
 
                public override MethodInfo GetRemoveMethod( bool nonPublic) {
                        MonoEventInfo info;
                        MonoEventInfo.get_event_info (this, out info);
-                               
-                       return info.remove_method;
+                       
+                       if (nonPublic || (info.remove_method != null && info.remove_method.IsPublic))
+                               return info.remove_method;
+                       return null;
+               }
+
+#if NET_2_0
+               public override MethodInfo[] GetOtherMethods (bool nonPublic) {
+                       MonoEventInfo info;
+                       MonoEventInfo.get_event_info (this, out info);
+
+                       return info.other_methods;
                }
+#endif
 
                public override Type DeclaringType {
                        get {
@@ -111,9 +128,25 @@ namespace System.Reflection {
                        }
                }
 
-               public override string ToString () {
+               public override string ToString ()
+               {
                        return EventHandlerType + " " + Name;
                }
 
+               public override bool IsDefined (Type attributeType, bool inherit)
+               {
+                       return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+               }
+
+               public override object[] GetCustomAttributes( bool inherit)
+               {
+                       return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+               }
+
+               public override object[] GetCustomAttributes( Type attributeType, bool inherit)
+               {
+                       return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+               }
+
        }
 }