public XmlReader GetIndexReader(string path) { XDocument doc = XDocument.Load(path); if (!string.IsNullOrEmpty(framework) && frameworkIndexCache == null) { frameworkIndexCache = FrameworkIndexHelper.CreateFrameworkIndex(path, framework); rootFolder = Path.GetDirectoryName(path); } DropApiStyle(doc, path); DropNSFromDocument(doc); DropExcludedFrameworksFromIndex(doc, frameworkIndexCache, GetTypeDocument); // now put the modified contents into a stream for the XmlReader that monodoc will use. MemoryStream io = new MemoryStream(); using (var writer = XmlWriter.Create(io)) { doc.WriteTo(writer); } io.Seek(0, SeekOrigin.Begin); return(XmlReader.Create(io)); }
public void ReadFrameworkIndex0() { Dictionary <string, FrameworkNamespaceModel> frameworkIndex = FrameworkIndexHelper.ReadFrameworkIndex(ReadXDocument(XmlConsts.FrameworkIndexXml).CreateReader()); Assert.AreEqual(1, frameworkIndex.Count); Assert.AreEqual(2, frameworkIndex["Namespace1"].Types.Count); Assert.AreEqual("Type1", frameworkIndex["Namespace1"].Types.Single(i => i.Id == "T:Type1").Name); Assert.AreEqual("Type2", frameworkIndex["Namespace1"].Types.Single(i => i.Id == "T:Type2").Name); }
private Dictionary <string, FrameworkNamespaceModel> GetFrameworkIndex(string frameworkIndexXml) { return(FrameworkIndexHelper.ReadFrameworkIndex(ReadXDocument(frameworkIndexXml).CreateReader())); }