示例#1
0
        private static TypeDoc _GenerateTypeDoc(TypeInfo typeInfo, List <XmlDocumentation> comments, string fileName)
        {
            var link = LinkCache.SetLink(typeInfo.CSharpName(), typeInfo.Name, fileName);

            link.Markdown = typeInfo.Name;

            var doc = new TypeDoc {
                AssociatedType = typeInfo.AsType()
            };

            var typeComment = comments.FirstOrDefault(c => c.MemberName == typeInfo.FullName &&
                                                      c.MemberType == MemberType.Type);

            doc.Tags.AddRange(typeComment.Data.Select(_ConvertToTag));

            var memberComments = typeInfo.GetAllMembers()
                                 .Where(m => m.IsPublic())
                                 .Join(comments,
                                       m => _GetMemberName(typeInfo, m),
                                       c => c.MemberName,
                                       (m, c) => new { Member = m, Comment = c });

            doc.Members.AddRange(memberComments.Select(mc => _ConvertToMember(mc.Member, mc.Comment, fileName)));

            return(doc);
        }
示例#2
0
        private static MemberDoc _ConvertToMember(MemberInfo memberInfo, XmlDocumentation member, string fileName)
        {
            var link = LinkCache.SetLink(memberInfo.GetLinkKey(),
                                         (memberInfo.IsStatic() ?? false) ? $"{memberInfo.DeclaringType.Name}.{memberInfo.Name}" : memberInfo.Name,
                                         fileName);

            MarkdownGenerator.UpdateLinkForMember(link, memberInfo);

            var doc = new MemberDoc
            {
                AssociatedMember = memberInfo,
                MemberType       = member.MemberType
            };

            doc.Tags.AddRange(member.Data.Select(_ConvertToTag));

            return(doc);
        }