Пример #1
0
        public override void PopulateTree(Tree tree)
        {
            var storage     = tree.HelpSource.Storage;
            var nsSummaries = new Dictionary <string, XElement> ();
            int resID       = 0;

            foreach (var asm in directories)
            {
                var indexFilePath = Path.Combine(asm, "index.xml");
                if (!File.Exists(indexFilePath))
                {
                    Console.Error.WriteLine("Warning: couldn't process directory `{0}' as it has no index.xml file", asm);
                    continue;
                }

                EcmaDoc.PopulateTreeFromIndexFile(indexFilePath, EcmaHelpSource.EcmaPrefix, tree, storage, nsSummaries, _ => resID++.ToString());
            }

            foreach (var summary in nsSummaries)
            {
                storage.Store("xml.summary." + summary.Key, summary.Value.ToString());
            }

            var masterSummary = new XElement("elements",
                                             directories
                                             .SelectMany(d => Directory.EnumerateFiles(d, "ns-*.xml"))
                                             .Select(ExtractNamespaceSummary));

            storage.Store("mastersummary.xml", masterSummary.ToString());
        }
Пример #2
0
        /* base_file: the directory containing the index.xml file, usually in Mono land .../Documentation/en
         * markName: if true, we encase the node caption with [] to clearly mark it's from an uncompiled source
         */
        public EcmaUncompiledHelpSource(string base_file, bool markName = true) : base()
        {
            basedir  = new DirectoryInfo(base_file);
            BasePath = basedir.FullName;

            basedoc = Path.Combine(basedir.FullName, "index.xml");

            Name = ((string)XDocument.Load(basedoc).Root.Element("Title")) ?? "UnnamedUncompiledSource";
            if (markName)
            {
                Name = '[' + Name + ']';
            }
            Tree.RootNode.Caption = Name;

            Func <XElement, string> indexGenerator = type => {
                var nsName   = (string)type.Parent.Attribute("Name");
                var typeName = (string)type.Attribute("Name");
                return(Path.ChangeExtension(nsName + '/' + typeName, ".xml"));
            };

            this.Storage = new UncompiledDocStorage(BasePath);

            EcmaDoc.PopulateTreeFromIndexFile(basedoc, UriPrefix, Tree, null, null, indexGenerator);
        }