Esempio n. 1
0
        protected IEnumerable <DocumentationNode> GetClassDeclarationBaseClasses(SyntaxNode nodeToDocument)
        {
            var baseNodes = new List <DocumentationNode>();

            var baseClasses = nodeToDocument.ChildNodes()
                              .OfType <BaseListSyntax>().FirstOrDefault();

            if (baseClasses != null)
            {
                var baseClasses2 = baseClasses.ChildNodes()
                                   .OfType <SimpleBaseTypeSyntax>();
                string identName = string.Empty;
                if (baseClasses2 != null)
                {
                    foreach (var baseClass in baseClasses2)
                    {
                        var identifierName = string.Empty;
                        var firstBaseNode  = baseClass.ChildNodes().First();
                        var bClass         = _model.GetSymbolInfo(firstBaseNode);
                        var bClassSymbol   = bClass.Symbol;
                        if (bClassSymbol == null)
                        {
                            continue;
                        }
                        var idName          = bClass.Symbol.Name.ToString();
                        var bClassNamespace = bClass.Symbol.ContainingNamespace.ToString();
                        if (bClassNamespace.Equals("<global namespace>"))
                        {
                            identifierName = idName;
                        }
                        else
                        {
                            identifierName = string.Format("{0}.{1}", bClassNamespace, idName);
                        }

                        var nullElement = Node.CreateXmlNullKeywordElement(SeeAlso, identifierName);
                        var baseNode    = new DocumentationNode(nullElement, DocumentationCommentDelimiter);
                        baseNodes.Add(baseNode);
                    }
                }
            }
            return(baseNodes);
        }
Esempio n. 2
0
        protected override IEnumerable <DocumentationNode> CreateNewSummaryNodes(SyntaxNode nodeToDocument)
        {
            var docNodes                 = new List <DocumentationNode>();
            var firstNewlineToken        = Token.CreateXmlTextNewLine();
            var firstPartSummaryComment  = Token.CreateXmlTextLiteral(SingleSpace, DocumentationCommentDelimiter);
            var secondNewlineToken       = Token.CreateXmlTextNewLine();
            var secondPartSummaryComment = Token.CreateXmlTextLiteral(SingleSpace, DocumentationCommentDelimiter);
            var elementTextNode          = Node.CreateXmlText(DocumentationCommentDelimiter,
                                                              new SyntaxToken[] { firstNewlineToken, firstPartSummaryComment, secondNewlineToken,
                                                                                  secondPartSummaryComment });
            var elementNode = Node.CreateExampleElementNode(elementTextNode, Summary);
            var docNode     = new DocumentationNode(elementNode, DocumentationCommentDelimiter);

            docNodes.Add(docNode);
            var baseNodes = GetClassDeclarationBaseClasses(nodeToDocument);

            foreach (var node in baseNodes)
            {
                docNodes.Add(node);
            }
            return(docNodes);
        }