// The user has passed us a namespace ("System"), // show the types in that namespace // ex: http://localhost/mscorlib.dll/System private ActionResult Namespace(NamespaceModel ns) { // Build the breadcrumb menu BreadCrumb bc = new BreadCrumb (); bc.Crumbs.Add (new Crumb ("Home", "~", "home")); bc.Crumbs.Add (new Crumb (ns.Assembly, ns.AssemblyUrl, "reference")); bc.Crumbs.Add (new Crumb (ns.Name, null, "namespace")); ViewData["BreadCrumb"] = bc; ViewData["Title"] = string.Format ("{0} - {1} Namespace", title, ns.Name); return View ("Namespace", ns); }
private void CreateIndex() { index = new List<AssemblyModel> (); foreach (string dir in Directory.GetDirectories (doc_dir)) { string index_file = Path.Combine (dir, "index.xml"); if (!File.Exists (index_file)) continue; XmlDocument doc = new XmlDocument (); doc.Load (index_file); AssemblyModel am = new AssemblyModel (); am.Name = GetChildText (doc.DocumentElement, "Title", "index.xml does not have <Title>") + ".dll"; am.Remarks = GetChildText (doc.DocumentElement, "Remarks", ""); foreach (XmlElement xe in doc.DocumentElement.SelectNodes ("Types/Namespace")) { NamespaceModel ns = new NamespaceModel (); ns.Assembly = am.Name; ns.Name = xe.GetAttribute ("Name"); foreach (XmlElement t in xe.SelectNodes ("Type")) { TypeModel tm = new TypeModel (); tm.Assembly = am.Name; tm.Name = t.GetAttribute ("Name"); ns.Types.Add (tm); } am.Namespaces.Add (ns); } index.Add (am); } }
private void PopulateTypesInNamespace(string assembly, NamespaceModel model) { string ns_file = Path.Combine (Path.Combine (doc_dir, assembly), "index.xml"); XmlDocument doc = new XmlDocument (); doc.Load (ns_file); model.Types.Clear (); XmlElement name_space = (XmlElement)doc.SelectSingleNode (string.Format ("Overview/Types/Namespace[@Name='{0}']", model.Name)); if (name_space == null) return; foreach (XmlElement xe in name_space.ChildNodes) { TypeModel t = new TypeModel (); t.Assembly = assembly; t.Namespace = model.Name; t.Name = xe.GetAttribute ("Name"); t.Kind = xe.GetAttribute ("Kind"); t.Summary = GetChildXml (xe, "summary", string.Empty); model.Types.Add (t); } }
// Read in the information needed for NamespaceModel // - Namespace overview + shallow list of Types public override NamespaceModel ReadNamespace(string assembly, string name) { string filename = string.Format ("ns-{0}.xml", name); string file = Path.Combine (Path.Combine (doc_dir, assembly), filename); XmlDocument doc = new XmlDocument (); doc.Load (file); NamespaceModel model = new NamespaceModel (); XmlElement xe = doc.DocumentElement; model.Assembly = assembly; model.Name = xe.GetAttribute ("Name"); XmlElement docs = xe["Docs"]; if (docs != null) { model.Summary = GetChildXml (docs, "summary", string.Empty); model.Remarks = GetChildXml (docs, "remarks", string.Empty); } PopulateTypesInNamespace (assembly, model); return model; }