public override void DoOutput() { if (document == null) { throw new InvalidOperationException("Document not set"); } XmlNode nclass = document.CreateElement("class", null); AddAttribute(nclass, "name", type.Name); string classType = GetClassType(type); AddAttribute(nclass, "type", classType); if (type.BaseType != null) { AddAttribute(nclass, "base", Utils.CleanupTypeName(type.BaseType)); } if (type.IsSealed) { AddAttribute(nclass, "sealed", "true"); } if (type.IsAbstract) { AddAttribute(nclass, "abstract", "true"); } if ((type.Attributes & TypeAttributes.Serializable) != 0 || type.IsEnum) { AddAttribute(nclass, "serializable", "true"); } string charSet = GetCharSet(type); AddAttribute(nclass, "charset", charSet); string layout = GetLayout(type); if (layout != null) { AddAttribute(nclass, "layout", layout); } if (type.PackingSize >= 0) { AddAttribute(nclass, "pack", type.PackingSize.ToString()); } if (type.ClassSize >= 0) { AddAttribute(nclass, "size", type.ClassSize.ToString()); } parent.AppendChild(nclass); AttributeData.OutputAttributes(document, nclass, GetCustomAttributes(type)); XmlNode ifaces = null; foreach (TypeReference iface in TypeHelper.GetInterfaces(type)) { if (!TypeHelper.IsPublic(iface)) { // we're only interested in public interfaces continue; } if (ifaces == null) { ifaces = document.CreateElement("interfaces", null); nclass.AppendChild(ifaces); } XmlNode iface_node = document.CreateElement("interface", null); AddAttribute(iface_node, "name", Utils.CleanupTypeName(iface)); ifaces.AppendChild(iface_node); } MemberData.OutputGenericParameters(document, nclass, type); ArrayList members = new ArrayList(); FieldDefinition [] fields = GetFields(type); if (fields.Length > 0) { Array.Sort(fields, MemberReferenceComparer.Default); FieldData fd = new FieldData(document, nclass, fields); members.Add(fd); } if (type.IsEnum) { var value_type = GetEnumValueField(type); if (value_type == null) { throw new NotSupportedException(); } AddAttribute(nclass, "enumtype", Utils.CleanupTypeName(value_type.FieldType)); } if (!Driver.AbiMode) { MethodDefinition [] ctors = GetConstructors(type); if (ctors.Length > 0) { Array.Sort(ctors, MemberReferenceComparer.Default); members.Add(new ConstructorData(document, nclass, ctors)); } PropertyDefinition[] properties = GetProperties(type); if (properties.Length > 0) { Array.Sort(properties, MemberReferenceComparer.Default); members.Add(new PropertyData(document, nclass, properties)); } EventDefinition [] events = GetEvents(type); if (events.Length > 0) { Array.Sort(events, MemberReferenceComparer.Default); members.Add(new EventData(document, nclass, events)); } MethodDefinition [] methods = GetMethods(type); if (methods.Length > 0) { Array.Sort(methods, MemberReferenceComparer.Default); members.Add(new MethodData(document, nclass, methods)); } } foreach (MemberData md in members) { md.DoOutput(); } var nested = type.NestedTypes; //remove non public(familiy) and nested in second degree for (int i = nested.Count - 1; i >= 0; i--) { TypeDefinition t = nested [i]; if ((t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic || (t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily || (t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem) { // public if (t.DeclaringType == type) { continue; // not nested of nested } } nested.RemoveAt(i); } if (nested.Count > 0) { XmlNode classes = document.CreateElement("classes", null); nclass.AppendChild(classes); foreach (TypeDefinition t in nested) { TypeData td = new TypeData(document, classes, t); td.DoOutput(); } } }