Inheritance: BaseDocModel
Beispiel #1
0
        // Read the information need for MemberModel
        public override MemberModel ReadMember(string assembly, string ns, string type, string member)
        {
            string path = Path.Combine (doc_dir, ns);
            string filename = string.Format ("{0}.xml", type);
            string file = Path.Combine (path, filename);

            XmlDocument doc = new XmlDocument ();
            doc.Load (file);

            XmlElement xe = (XmlElement)doc.SelectSingleNode (string.Format ("Type/Members/Member[@MemberName = '{0}']", member));
            MemberModel model = new MemberModel ();

            model.Namespace = ns;
            model.Name = xe.GetAttribute ("MemberName");
            model.ParentType = type;
            model.Type = GetChildXml (xe, "MemberType", string.Empty);
            model.ReturnType = GetChildText (xe, "ReturnValue", string.Empty);
            model.ReturnSummary = GetChildXml (xe, "returns", string.Empty);

            // Populate the member signature
            XmlElement sig = (XmlElement)xe.SelectSingleNode ("MemberSignature[@Language='C#']");

            if (sig != null) {
                model.Signature = new Signature (sig);
                model.Visibility = model.Signature.Visibility;
            }

            // Populate the member parameters
            XmlElement parameters = xe["Parameters"];
            XmlElement docs = xe["Docs"];

            if (parameters != null)
                foreach (XmlElement p in parameters.ChildNodes)
                    model.Parameters.Add (new Parameter (p, docs));

            // Populate the documentation
            if (docs != null) {
                model.Summary = GetChildXml (docs, "summary", string.Empty);
                model.Remarks = GetChildXml (docs, "remarks", string.Empty);
            }

            // Populate the AssemblyInfo
            XmlElement assem = xe["AssemblyInfo"];

            if (assem != null)
                model.AssemblyInfo = new AssemblyInfo (assem);

            return model;
        }
Beispiel #2
0
        // The user has passed us a type member ("System.String.Trim ()"),
        // show the documentation of the member
        // ex: http://localhost/mscorlib.dll/System.String.Trim
        private ActionResult Member(MemberModel member)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (member.Assembly, member.AssemblyUrl, "reference"));
            bc.Crumbs.Add (new Crumb (member.Namespace, member.NamespaceUrl, "namespace"));
            bc.Crumbs.Add (new Crumb (member.ParentType, member.TypeUrl, "pubclass"));
            bc.Crumbs.Add (new Crumb ("Members", member.MembersUrl, "members"));
            bc.Crumbs.Add (new Crumb (member.FormattedSignature, null, member.MemberIcon));

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

            return View ("Member", member);
        }
Beispiel #3
0
        private void PopulateMembersInType(TypeModel model, XmlElement xe)
        {
            model.Members.Clear ();

            string type_name = xe.GetAttribute ("Name");

            foreach (XmlElement x in xe["Members"].ChildNodes) {
                MemberModel m = new MemberModel ();

                m.Assembly = model.Assembly;
                m.Namespace = model.Namespace;
                m.Name = x.GetAttribute ("MemberName");
                m.Type = GetChildXml (x, "MemberType", string.Empty);
                m.ParentType = model.Name;
                m.ReturnType = GetChildText (x, "ReturnValue", string.Empty);
                m.ReturnSummary = GetChildXml (x, "returns", string.Empty);

                // Populate the member signature
                XmlElement sig = (XmlElement)x.SelectSingleNode ("MemberSignature[@Language='C#']");

                if (sig != null) {
                    m.Signature = new Signature (sig);
                    m.Visibility = m.Signature.Visibility;
                }

                // Populate the member parameters
                XmlElement parameters = x["Parameters"];
                XmlElement docs = x["Docs"];

                if (parameters != null)
                    foreach (XmlElement p in parameters.ChildNodes)
                        m.Parameters.Add (new Parameter (p, docs));

                // Populate the documentation
                if (docs != null) {
                    m.Summary = GetChildXml (docs, "summary", string.Empty);
                    m.Remarks = GetChildXml (docs, "remarks", string.Empty);
                }

                // Populate the AssemblyInfo
                XmlElement assem = x["AssemblyInfo"];

                if (assem != null)
                    m.AssemblyInfo = new AssemblyInfo (assem);

                model.Members.Add (m);
            }
        }