Exemple #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);
        }
Exemple #2
0
	public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles)
	{
		if (docTree == null) {
			docTree = new XmlDocument ();
			using (var defTree = typeof(RootTree).Assembly.GetManifestResourceStream ("monodoc.xml"))
				docTree.Load (defTree);
		}


		sourceFiles = sourceFiles ?? new string [0];

		//
		// Load the layout
		//

		RootTree root = new RootTree ();
		root.basedir = indexDir;

		XmlNodeList nodes = docTree.SelectNodes ("/node/node");

		root.name_to_node ["root"] = root;
		root.name_to_node ["libraries"] = root;
		root.Populate (root, nodes);

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

		//
		// Load the sources
		//
		foreach (var sourceFile in sourceFiles){
			root.AddSourceFile (sourceFile);
		}
		
		foreach (string path in UncompiledHelpSources) {
			EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
			hs.RootTree = root;
			root.help_sources.Add (hs);
			string epath = "extra-help-source-" + hs.Name;
			Node hsn = root.CreateNode (hs.Name, "root:/" + epath);
			root.name_to_hs [epath] = hs;
			hsn.EnsureNodes ();
			foreach (Node n in hs.Tree.Nodes){
				hsn.AddNode (n);
			}
		}
		
		// Clean the tree
		PurgeNode(root);

		root.Sort ();

		return root;
	}