Inheritance: BaseDocModel
Beispiel #1
0
        // The user has passed us an assembly ("mscorlib.dll"),
        // show the namespaces in that assembly
        // ex: http://localhost/mscorlib.dll/System
        private ActionResult Assembly(AssemblyModel model)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (model.Name, null, "reference"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1} Assembly", title, model.Name);

            return View ("Assembly", model);
        }
Beispiel #2
0
        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);
            }
        }