void GenerateCache(Options opts, string basePath, string format, string outDir) { var hs = RootTree.GetHelpSource(format, basePath); if (hs == null) { Error("Unable to find a HelpSource for provider '{0}' and file '{1}.tree'.", format, basePath); } var tree = hs.Tree; RootTree docRoot = null; if (!opts.UseSystemSources) { docRoot = RootTree.LoadTree(null, null, opts.Sources); } else { docRoot = RootTree.LoadTree(); foreach (var source in opts.Sources) { docRoot.AddSourceFile(source); } } hs.RootTree = docRoot; string helpSourceName = Path.GetFileName(basePath); foreach (Node node in tree.TraverseDepthFirst <Node, Node> (t => t, t => t.Nodes.Cast <Node> ())) { var url = node.URL; Message(TraceLevel.Info, "\tProcessing URL: {0}", url); if (string.IsNullOrEmpty(url)) { continue; } var file = XmlDocUtils.GetCachedFileName(outDir, url); using (var o = File.AppendText(file)) { Node _; string contents = hs.GetText(url, out _) ?? hs.RenderNamespaceLookup(url, out _); o.Write(contents); } } }