Esempio n. 1
0
        private void RenderInheritanceLevel(TypeReference typeReference, MDDocument md)
        {
            var typeDefinition = typeReference.Resolve();

            if (typeDefinition.BaseType != null)
            {
                this.RenderInheritanceLevel(typeDefinition.BaseType, md);
            }

            var stringBuilder = new StringBuilder();

            for (int i = 0; i < this.currInheritanceLevel; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    stringBuilder.Append(SPACE);
                }
            }

            this.currInheritanceLevel++;

            md.AddElement(new MDText
            {
                Text = $"{stringBuilder.ToString()}{typeDefinition.FullName}",
            });
            md.AddElement(new MDText
            {
                Text = $"{Environment.NewLine}{Environment.NewLine}",
            });
        }
Esempio n. 2
0
        protected override void OnBeforeSyntax(MDDocument md)
        {
            md.AddElement(new MDH2
            {
                Text = "Inheritance Hierarchy",
            });

            this.RenderInheritanceLevel(this.TypeDocumentation.TypeDefinition, md);
        }
Esempio n. 3
0
        private void AddTables(TypeDocumentation type, MDDocument md)
        {
            var path = $"{this.rootName}/{type.FullName.Replace(".", "/")}";

            this.AddTable("Constructors", $"{path}/Constructors", type.ConstructorDocumentations, md);

            this.AddTable("Properties", $"{path}/Properties", type.PropertyDocumentations, md);

            this.AddTable("Methods", $"{path}/Methods", type.MethodDocumentations, md);

            this.AddTable("Fields", $"{path}/Fields", type.FieldDocumentations, md);
        }
Esempio n. 4
0
        protected override void OnAfterSyntax(MDDocument md)
        {
            md.AddElement(new MDH5
            {
                Text = "Parameters",
            });

            foreach (var param in this.MethodDocumentation.ParameterDocumentations)
            {
                md.AddElement(new MDItalics
                {
                    Text = param.Name,
                });
                md.AddElement(new MDText
                {
                    Text = $"{Environment.NewLine}{Environment.NewLine}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}",
                });
                md.AddElement(new MDText
                {
                    Text = $"Type: {param.TypeName}{Environment.NewLine}{Environment.NewLine}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}",
                });
                md.AddElement(new MDText
                {
                    Text = $"{param.Summary}{Environment.NewLine}{Environment.NewLine}",
                });
                md.AddElement(new MDText
                {
                    Text = $"{Environment.NewLine}",
                });
            }

            md.AddElement(new MDH5
            {
                Text = "Return Value",
            });

            md.AddElement(new MDText
            {
                Text = $"Type: {this.MethodDocumentation.ReturnValueDocumentation.TypeName}{Environment.NewLine}{Environment.NewLine}",
            });
            md.AddElement(new MDText
            {
                Text = $"{this.MethodDocumentation.ReturnValueDocumentation.Summary}{Environment.NewLine}{Environment.NewLine}",
            });
        }
        //Add and Update MDDocument

        public MDDocument AddandUpdateMDDocument(MDDocument document)
        {
            MDDocument documentAppeal = new MDDocument();


            if (document.Id == 0)
            {
                documentAppeal = _MDDocument.AddData(document);
            }
            else
            {
                documentAppeal = _MDDocument.UpdateData(document);
            }



            return(documentAppeal);
        }
Esempio n. 6
0
        public string Generate()
        {
            var md = new MDDocument();

            // Add the header.
            md.AddElement(new MDH1
            {
                Text = this.GetHeader(),
            });

            if (!string.IsNullOrEmpty(this.Documentation.Summary?.InnerText))
            {
                md.AddElement(new MDQuote
                {
                    Quote = this.Documentation.Summary?.InnerText?.Trim(),
                });
            }

            md.AddElement(new MDBold
            {
                Text = "Namespace:",
            });

            md.AddElement(new MDText
            {
                Text = $" {this.TypeDocumentation.Namespace}{Environment.NewLine}{Environment.NewLine}",
            });

            md.AddElement(new MDBold
            {
                Text = "Assembly:",
            });

            md.AddElement(new MDText
            {
                Text = $" {this.AssemblyDocumentation.Name} (in {this.AssemblyDocumentation.FileName}){Environment.NewLine}",
            });

            this.OnBeforeSyntax(md);

            md.AddElement(new MDH2
            {
                Text = "Syntax",
            });

            md.AddElement(new MDCode
            {
                Code     = this.Documentation.Declaration,
                Language = "csharp",
            });

            this.OnAfterSyntax(md);

            this.OnBeforeRemarks(md);

            if (!string.IsNullOrWhiteSpace(this.Documentation.Remarks?.InnerText))
            {
                md.AddElement(new MDH2
                {
                    Text = "Remarks",
                });

                md.AddElement(new MDText
                {
                    Text = this.Documentation.Remarks?.InnerText?.Trim(),
                });
            }

            return(md.Generate());
        }
Esempio n. 7
0
 protected virtual void OnBeforeSyntax(MDDocument md)
 {
 }
Esempio n. 8
0
 protected virtual void OnBeforeRemarks(MDDocument md)
 {
 }
Esempio n. 9
0
 protected virtual void OnAfterSyntax(MDDocument md)
 {
 }
Esempio n. 10
0
 public MDDocument AddandUpdateMDDocument(MDDocument documentr)
 {
     return(_MDDocumentService.AddandUpdateMDDocument(documentr));
 }
Esempio n. 11
0
 protected override void OnBeforeRemarks(MDDocument md)
 {
     this.AddTables(this.TypeDocumentation, md);
 }
Esempio n. 12
0
        private void AddTable(string tableName, string path, IEnumerable <DocumentationBase> items, MDDocument md)
        {
            if (!items.Any())
            {
                return;
            }

            md.AddElement(new MDH2
            {
                Text = tableName,
            });

            var table = new MDTable();

            table.Header.Cells.Add(new MDText
            {
                Text = "Name",
            });
            table.Header.Cells.Add(new MDText
            {
                Text = "Description",
            });

            foreach (var item in items)
            {
                var row = new MDTableRow();
                row.Cells.Add(new MDLink
                {
                    Text = item.Name,
                    Url  = $"/{path}/{HttpUtility.UrlEncode(item.GetSafeName()).Replace("+", "%20")}.md",
                });
                row.Cells.Add(new MDText
                {
                    Text = item.Summary?.InnerText?.Trim(),
                });
                table.Rows.Add(row);
            }

            md.AddElement(table);
        }