public void DescribeType(Type type, SlashdocSummaryHtmlFormatter formatter) { if (type == null) { throw new ArgumentNullException("type"); } _writer.WriteStartElement("div"); _writer.WriteAttributeString("id", _language.GetDisplayName(type)); var displayName = _language.GetShortDisplayName(type); var metaType = _language.GetMetaTypeName(type); WriteTypeHeader(type, displayName, metaType, formatter); if (type.IsEnum) { var values = ReflectionHelper.GetEnumMembers(type) .OrderBy(x => x.GetRawConstantValue()); WriteSection("Members", values, (x) => x.Name, (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); } else if (!HideMembers(type)) { WriteTextElement("p", string.Format(CultureInfo.InvariantCulture, "The {0} {1} exposes the following members.", displayName, metaType)); var constructors = ReflectionHelper.GetVisibleConstructors(type) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Constructors", constructors, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); var properties = ReflectionHelper.GetVisibleProperties(type) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Properties", properties, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); var methods = ReflectionHelper.GetVisibleMethods(type) .Where(x => !ReflectionHelper.IsTrivialMethod(x)) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Methods", methods, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); var operators = ReflectionHelper.GetVisibleOperators(type) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Operators", operators, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); var fields = ReflectionHelper.GetVisibleFields(type) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Fields", fields, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); var events = ReflectionHelper.GetVisibleEvents(type) .OrderBy(x => SlashdocIdentifierProvider.GetId(x)); WriteSection("Events", events, (x) => _language.GetSignature(x), (x) => SlashdocIdentifierProvider.GetId(x), (x) => displayName + "." + x.Name, formatter); } _writer.WriteEndElement(); // div }
private string CreateFragmentLinkForType(string cref) { if (string.IsNullOrWhiteSpace(cref)) { return string.Empty; } var typeName = SlashdocIdentifierProvider.GetTypeName(cref); if (typeName == null) { if (cref.Length > 2 && cref[1] == ':') { return cref.Substring(2); } else { return string.Empty; } } var type = _assemblyReflector.LookupType(typeName); if (type != null) { return string.Format( CultureInfo.InvariantCulture, "<a href=\"#{0}\">{1}</a>", XmlEscape(_language.GetDisplayName(type)), XmlEscape(_language.GetShortDisplayName(type))); } else { return XmlEscape(typeName); } }