static string WriteIndex() { DocIndexFolder root = new DocIndexFolder("Pages"); DocIndexFolder reference = new DocIndexFolder("Reference"); root.folders.Add(reference); for (int i = 0; i < classes.Count; i++) { DocIndexFolder classFolder = new DocIndexFolder(classes[i].name); reference.folders.Add(classFolder); for (int f = 0; f < classes[i].fields.Count; f++) { classFolder.pages.Add(classes[i].fields[f].name); } for (int m = 0; m < classes[i].methods.Count; m++) { classFolder.pages.Add(classes[i].methods[m].ShowName); } } DocExampleFinder.examples.Sort((a, b) => a.info.CompareTo(b.info)); for (int e = 0; e < DocExampleFinder.examples.Count; e++) { DocExample ex = DocExampleFinder.examples[e]; if (ex.type == ExampleType.Document) { DocIndexFolder folder = null; if (ex.category.ToLower() == "root") { folder = root; } else { folder = root.folders.Find((a) => a.name == ex.category); } if (folder == null) { folder = new DocIndexFolder(ex.category); root.folders.Add(folder); } folder.pages.Add(ex.Name); } } root.folders.Sort((a, b) => string.Compare(a.name, b.name)); reference.folders.Sort((a, b) => string.Compare(a.name, b.name)); return(root.ToString()); }
public static void ParseFile(string contents) { string[] lines = contents.Split('\n'); DocExample curr = null; for (int i = 0; i < lines.Length; i++) { if (curr == null) { string trim = lines[i].Trim(); if (trim.StartsWith("///") && lines[i].Contains(":CodeSample:")) { curr = new DocExample(ExampleType.CodeSample, lines[i].Substring(lines[i].LastIndexOf(':')).Trim()); examples.Add(curr); } else if (trim.StartsWith("///") && lines[i].Contains(":CodeDoc:")) { string docName = lines[i].Substring(lines[i].LastIndexOf(':') + 1).Trim(); curr = FindDoc(docName); if (curr == null) { curr = new DocExample(ExampleType.Document, docName); examples.Add(curr); } } } else { string trim = lines[i].Trim(); if (trim.StartsWith("///") && lines[i].Contains(":End:")) { curr.End(); curr = null; } else { curr.AddLine(lines[i]); } } } if (curr != null) { Console.WriteLine("Missing an :End: in documentation code sample for " + curr.Name + "!"); } }
static string WriteIndex() { DocIndexFolder root = new DocIndexFolder("Pages"); DocIndexFolder reference = new DocIndexFolder("Reference"); root.folders.Add(reference); for (int i = 0; i < classes.Count; i++) { DocIndexFolder classFolder = new DocIndexFolder(classes[i].Name); reference.folders.Add(classFolder); // Enums don't need child items, it's a little much. if (classes[i].IsEnum) { continue; } for (int f = 0; f < classes[i].fields.Count; f++) { classFolder.folders.Add(new DocIndexFolder(classes[i].fields[f].name)); } for (int m = 0; m < classes[i].methods.Count; m++) { classFolder.folders.Add(new DocIndexFolder(classes[i].methods[m].ShowName)); } } DocExampleFinder.examples.Sort((a, b) => a.info.CompareTo(b.info)); for (int e = 0; e < DocExampleFinder.examples.Count; e++) { DocExample ex = DocExampleFinder.examples[e]; if (ex.type == ExampleType.Document) { DocIndexFolder folder = null; if (ex.category.ToLower() == "root") { folder = root; } else { folder = root.folders.Find((a) => a.name == ex.category); } if (folder == null) { folder = new DocIndexFolder(ex.category, ex.SortIndex); root.folders.Add(folder); } folder.folders.Add(new DocIndexFolder(ex.Name, ex.SortIndex)); } } for (int i = 0; i < root.folders.Count; i++) { if (root.folders[i] == reference) { continue; } root.folders[i].folders.Sort((a, b) => a.order - b.order); } root.folders.Sort((a, b) => string.Compare(a.name, b.name)); reference.folders.Sort((a, b) => string.Compare(a.name, b.name)); return(root.ToString()); }
public void AddExample(DocExample aExample) { examples.Add(aExample); }
public void AddExample(DocExample aExample) { throw new NotImplementedException(); }