Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        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);
            };
        }