private void DoWriteType(string indent, TypeDefinition type) { if (type.HasCustomAttributes) DoAppendCustomAttributes(indent, type.CustomAttributes); if ((type.Attributes & TypeAttributes.LayoutMask) != 0 || // note that we have to use the 0 literal or the runtime gets confused about which zero enum we're referring to (type.Attributes & TypeAttributes.StringFormatMask) != 0 || type.PackingSize != 0) m_writer.WriteLine(indent + type.LayoutToText(false)); if (type.HasSecurityDeclarations) DoAppendSecurity(indent, type.SecurityDeclarations); if (type.IsSerializable) m_writer.WriteLine(indent + "[Serializable]"); m_writer.Write(indent); m_writer.Write("{0}", GetModifiers(type, type.Attributes)); m_writer.Write(DoGetQualifiedTypeName(type, false)); if (type.IsEnum) { FieldDefinition field = type.Fields.SingleOrDefault(f => f.Name == "value__"); if (field != null && field.FieldType.FullName != "System.Int32") { m_writer.Write(" : "); m_writer.Write(DoGetQualifiedTypeName(field.FieldType, false)); } } else if (type.BaseType != null) { m_writer.Write(" : "); m_writer.Write(DoGetQualifiedTypeName(type.BaseType, false)); } if (type.HasInterfaces) { if (type.BaseType != null) m_writer.Write(", "); else m_writer.Write(" : "); for (int i = 0; i < type.Interfaces.Count; ++i) { m_writer.Write(DoGetQualifiedTypeName(type.Interfaces[i], false)); if (i + 1 < type.Interfaces.Count) m_writer.Write(", "); } } if (!m_addBraceLine) m_writer.Write(" {0}", "{"); m_writer.WriteLine(); }