4 compare file1.dll file2.dll annotations.xml
6 file1.dll: This is an assembly created by Microsoft.
8 file2.dll: This is a Mono assembly (currently we have none
11 annotations.xml: contains comments about a class:
13 <class name="System.Object">
15 <email>miguel@ximian.com</email>
16 <name>Miguel de Icaza</name>
18 <status test-suite="no" percent="XX">
21 That would generate an XML file with all the classes that are
22 implemented in the second library. If there is nothing for a
23 given class, it should generate an emtpy group:
25 <class name="System.Object">
30 Using a Perl script that can grok XML, generate HTML pages
31 that we can put on the web site:
34 Per maintainer status.
40 using System
.Collections
;
41 using System
.Reflection
;
49 XmlDocument annotations
, output
;
51 public Mapper(string ms_lib
, string mono_lib
, string annotation
)
53 Assembly ms
= Assembly
.LoadFrom (ms_lib
);
54 Assembly mono
= Assembly
.LoadFrom (mono_lib
);
55 annotations
= new XmlDocument ();
56 annotations
.Load (annotation
);
57 output
= new XmlDocument ();
60 void DumpMember (MemberInfo mi
)
65 switch (mi
.MemberType
)
67 case MemberTypes
.Field
:
70 case MemberTypes
.Method
:
71 if (((MethodInfo
)mi
).IsSpecialName
) {
75 more
= " signature='" + mi
.ToString() +"'";
77 case MemberTypes
.Event
:
80 case MemberTypes
.Property
:
84 kind
= "***UNKOWN***";
89 void DumpType (Type t
)
91 string kind
, name
, attrs
= "";
97 } else if (t
.IsInterface
) {
99 } else if (t
.IsValueType
) {
101 } else if (t
.IsEnum
) {
106 attrs
+= "abstract='true'";
107 } else if (t
.IsSealed
) {
108 attrs
+= "sealed='true'";
109 } else if (t
.IsCOMObject
) {
110 attrs
+= "comobject='true'";
113 foreach (Type type
in t
.GetNestedTypes ()) {
117 foreach (FieldInfo field
in t
.GetFields ()) {
121 foreach (MethodInfo method
in t
.GetMethods ()) {
127 void LoadTypeList (Type
[] types
)
129 foreach (Type t
in types
) {
139 name
= ms
.GetName ().Name
;
140 types
= ms
.GetExportedTypes ();
141 modules
= ms
.GetModules ();
143 DumpTypeList (types
);
146 public static int Main(string[] args
)
149 string basedir
= "c:\\WINDOWS\\Microsoft.NET\\Framework\\v1.0.2914\\";
151 if (args
.Length
!= 3) {
152 Console
.WriteLine ("usage: compare ms_lib.dll mono_lib.dll annotations.xml");
155 m
= new Mapper (args
[0], args
[1], args
[2]);
157 } catch (Exception e
) {
158 Console
.WriteLine("Error: " + e
.ToString ());