Add new mkbundle tool
[mono.git] / mcs / tools / corcompare / MissingEvent.cs
index 9160d0f500589cfc78bf845d33cf1ed90b3f7e7a..fb037c2319b29e8e1d523b569a828b9a5ba2c3f4 100644 (file)
@@ -7,6 +7,7 @@
 
 using System;
 using System.Reflection;
+using System.Xml;
 
 namespace Mono.Util.CorCompare {
 
@@ -19,12 +20,91 @@ namespace Mono.Util.CorCompare {
        /// </remarks>
        class MissingEvent : MissingMember {
                // e.g. <method name="Equals" status="missing"/>
-               public MissingEvent (MemberInfo info) : base (info) {}
+               public MissingEvent (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+               MissingMethod mmAdd;
+               MissingMethod mmRemove;
+               MissingMethod mmRaise;
 
                public override string Type {
                        get {
                                return "event";
                        }
                }
+
+               public override NodeStatus Analyze ()
+               {
+                       m_nodeStatus = base.Analyze ();
+
+                       EventInfo eiMono = (EventInfo) mInfoMono;
+                       EventInfo eiMS   = (EventInfo) mInfoMS;
+
+                       MemberInfo miAddMono, miRemoveMono, miRaiseMono;
+                       if (eiMono == null)
+                               miAddMono = miRemoveMono = miRaiseMono = null;
+                       else
+                       {
+                               miAddMono = eiMono.GetAddMethod ();
+                               miRemoveMono = eiMono.GetRemoveMethod ();
+                               miRaiseMono = eiMono.GetRaiseMethod ();
+                       }
+
+                       MemberInfo miAddMS, miRemoveMS, miRaiseMS;
+                       if (eiMS == null)
+                               miAddMS = miRemoveMS = miRaiseMS = null;
+                       else
+                       {
+                               miAddMS = eiMS.GetAddMethod ();
+                               miRemoveMS = eiMS.GetRemoveMethod ();
+                               miRaiseMS = eiMS.GetRaiseMethod ();
+                       }
+
+                       if (miAddMono != null || miAddMS != null)
+                       {
+                               mmAdd = new MissingMethod (miAddMono, miAddMS);
+                               m_nodeStatus.AddChildren (mmAdd.Analyze ());
+                       }
+                       if (miRemoveMono != null || miRemoveMS != null)
+                       {
+                               mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
+                               m_nodeStatus.AddChildren (mmRemove.Analyze ());
+                       }
+                       if (miRaiseMono != null || miRaiseMS != null)
+                       {
+                               mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
+                               m_nodeStatus.AddChildren (mmRaise.Analyze ());
+                       }
+                       return m_nodeStatus;
+               }
+
+               public override XmlElement CreateXML (XmlDocument doc)
+               {
+                       XmlElement eltMember = base.CreateXML (doc);
+
+                       if (mInfoMono != null && mmRaise != null)
+                       {
+                               XmlElement eltAccessors = (XmlElement) eltMember.SelectSingleNode ("accessors");
+                               if (eltAccessors == null)
+                               {
+                                       eltAccessors = doc.CreateElement ("accessors");
+                                       eltMember.AppendChild (eltAccessors);
+                               }
+                               if (mmAdd != null)
+                               {
+                                       XmlElement eltAdd = mmAdd.CreateXML (doc);
+                                       eltAccessors.AppendChild (eltAdd);
+                               }
+                               if (mmRemove != null)
+                               {
+                                       XmlElement eltRemove = mmRemove.CreateXML (doc);
+                                       eltAccessors.AppendChild (eltRemove);
+                               }
+                               if (mmRaise != null)
+                               {
+                                       XmlElement eltRaise = mmRaise.CreateXML (doc);
+                                       eltAccessors.AppendChild (eltRaise);
+                               }
+                       }
+                       return eltMember;
+               }
        }
 }