Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }