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); }; }
public DocumentationGenerator( IMarkdownWriter writer, OrderedTypeList typeList, bool msdnLinks = false, string msdnView = null, bool documentMethodDetails = false) { Reader = new DocXmlReader(); Writer = writer; TypeList = typeList; typeLinkConverter = (type, _) => { if (TypeList.TypesToDocumentSet.Contains(type)) { return(type.IsGenericTypeDefinition ? Writer.HeadingLink(TypeTitle(type), type.Name.CleanGenericTypeName()) : Writer.HeadingLink(TypeTitle(type), type.ToNameString())); } if (msdnLinks && type != typeof(string) && (!type.IsValueType || type.IsEnum) && (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); }; DocumentMethodDetails = documentMethodDetails; }