Пример #1
0
        private void AddDocumentation(string xmlName)
        {
            var document = new XmlDocument();

            document.Load(xmlName);

            foreach (XmlNode m in document.SelectSingleNode(".//members"))
            {
                if (m.Attributes == null)
                {
                    continue;
                }

                var d = new DocInfo();

                var n = m.SelectSingleNode("summary");
                if (n != null)
                {
                    d.Summary = string.Join("\n", n.InnerText.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(x => CleanLine(x)).Skip(1));
                }

                n = m.SelectSingleNode("example");
                if (n != null)
                {
                    d.Example = string.Join("\n", n.InnerText.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(x => CleanLine(x)).Skip(1));
                }

                Documentation.Add(m.Attributes["name"].Value, d);
            }
        }
Пример #2
0
        private void AddDocumentation(Page page, DocInfo classDoc)
        {
            if (classDoc == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(classDoc.Summary))
            {
                page.WriteLine("### Summary");
                page.WriteLine($"{classDoc.Summary}");
                page.WriteLine("");
            }

            if (!string.IsNullOrEmpty(classDoc.Example))
            {
                page.WriteLine("### Example");
                page.WriteLine("```csharp");
                page.WriteLine($"{classDoc.Example}");
                page.WriteLine("```");
                page.WriteLine("");
            }
        }
Пример #3
0
        private void VariablePage(string parentName, string Name, string TypeName, string Definition, DocInfo doc)
        {
            var page = new Page();

            page.Name = parentName + "." + Name;

            page.WriteLine($"# {Name}");

            page.WriteLine($"## {TypeName}");
            page.WriteLine($"{Definition}");
            page.WriteLine("");

            AddDocumentation(page, doc);

            Pages.Add(page);
        }