public DocumentationGenerator( IMarkdownWriter writer, TypeCollection typeCollection, Type firstType = null) { Reader = new DocXmlReader(); Writer = writer; TypeCollection = typeCollection; TypesToDocument = typeCollection.ReferencedTypes.Values .OrderBy(t => t.Type.Namespace) .ThenBy(t => t.Type.Name).ToList(); if (firstType != null) { var typeDesc = TypesToDocument.FirstOrDefault(t => t.Type == firstType); if (typeDesc != null) { TypesToDocument.Remove(typeDesc); TypesToDocument.Insert(0, typeDesc); } } TypesToDocumentSet = new HashSet <Type>(TypesToDocument.Select(t => t.Type)); typeLinkConverter = (type, _) => TypesToDocumentSet.Contains(type) ? Writer.HeadingLink(TypeTitle(type), type.ToNameString()) : null; }
public OrderedTypeList(TypeCollection typeCollection, Type firstType = null) { TypeCollection = typeCollection; TypesToDocument = typeCollection.ReferencedTypes.Values .OrderBy(t => t.Type.Namespace) .ThenBy(t => t.Type.Name).ToList(); TypesToDocumentSet = new HashSet <Type>(TypesToDocument.Select(t => t.Type)); if (firstType != null) { var typeDesc = TypesToDocument.FirstOrDefault(t => t.Type == firstType); if (typeDesc != null) { TypesToDocument.Remove(typeDesc); TypesToDocument.Insert(0, typeDesc); } } }
public DocumentationGenerator( IMarkdownWriter writer, TypeCollection typeCollection, Type firstType = null, bool msdnLinks = false, string msdnView = null) { Reader = new DocXmlReader(); Writer = writer; TypeCollection = typeCollection; TypesToDocument = typeCollection.ReferencedTypes.Values .OrderBy(t => t.Type.Namespace) .ThenBy(t => t.Type.Name).ToList(); if (firstType != null) { var typeDesc = TypesToDocument.FirstOrDefault(t => t.Type == firstType); if (typeDesc != null) { TypesToDocument.Remove(typeDesc); TypesToDocument.Insert(0, typeDesc); } } TypesToDocumentSet = new HashSet <Type>(TypesToDocument.Select(t => t.Type)); typeLinkConverter = (type, _) => { if (TypesToDocumentSet.Contains(type)) { return(Writer.HeadingLink(TypeTitle(type), type.ToNameString())); } if (msdnLinks && (type.Assembly.ManifestModule.Name.StartsWith("System.") || type.Assembly.ManifestModule.Name.StartsWith("Microsoft."))) { return(Writer.Link(MsdnUrlForType(type, msdnView), type.IsGenericTypeDefinition ? type.Name.CleanGenericTypeName() : type.ToNameString())); } if (type.IsGenericTypeDefinition) { return($"{type.Name.CleanGenericTypeName()}"); } return(null); }; }