Beispiel #1
0
        public static RootTree LoadTree(string indexDir, XmlDocument docTree, IEnumerable <string> sourceFiles)
        {
            if (docTree == null)
            {
                docTree = new XmlDocument();
                using  (Stream manifestResourceStream = typeof(RootTree).Assembly.GetManifestResourceStream("monodoc.xml")) {
                    docTree.Load(manifestResourceStream);
                }
            }

            sourceFiles = (sourceFiles ?? new string[0]);
            RootTree rootTree = new RootTree();

            rootTree.basedir = indexDir;
            XmlNodeList xml_node_list = docTree.SelectNodes("/node/node");

            rootTree.nameToNode["root"]      = rootTree.RootNode;
            rootTree.nameToNode["libraries"] = rootTree.RootNode;
            rootTree.Populate(rootTree.RootNode, xml_node_list);

            if (rootTree.LookupEntryPoint("various") == null)
            {
                Console.Error.WriteLine("No 'various' doc node! Check monodoc.xml!");
                Node rootNode = rootTree.RootNode;
            }

            foreach (string current in sourceFiles)
            {
                rootTree.AddSourceFile(current);
            }

            foreach (string path in uncompiledHelpSourcePaths)
            {
                var hs = new Providers.EcmaUncompiledHelpSource(path);
                hs.RootTree = rootTree;
                rootTree.helpSources.Add(hs);
                string epath = "extra-help-source-" + hs.Name;
                Node   hsn   = rootTree.RootNode.CreateNode(hs.Name, RootNamespace + epath);
                rootTree.nameToHelpSource [epath] = hs;
                hsn.EnsureNodes();
                foreach (Node n in hs.Tree.RootNode.ChildNodes)
                {
                    hsn.AddNode(n);
                }
            }

            RootTree.PurgeNode(rootTree.RootNode);
            rootTree.RootNode.Sort();
            return(rootTree);
        }
Beispiel #2
0
        static bool PurgeNode(Node node)
        {
            bool result = false;

            if (!node.Documented)
            {
                List <Node> list = new List <Node> ();
                foreach (Node current in node.ChildNodes)
                {
                    bool flag = RootTree.PurgeNode(current);
                    if (flag)
                    {
                        list.Add(current);
                    }
                }
                result = (node.ChildNodes.Count == list.Count);
                foreach (Node current2 in list)
                {
                    node.DeleteNode(current2);
                }
            }
            return(result);
        }