Ejemplo n.º 1
0
 /// <summary>Shows the documentation of a given node (where possible).</summary>
 void TreeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (Members.ContainsKey(e.Node))
     {
         var minfo = Members[e.Node];
         ShownDocumentation FieldDoc = OpenDocumentation(minfo);
         var tp = GetType(minfo);
         ShownDocumentation TypDoc = OpenDocumentation(tp);
         richTextBox1.Text = "Field: " + minfo.Name + "\n" + GetText(FieldDoc) + "\n--------\nType: " + tp.FullName + "\n" + GetText(TypDoc) + "\n";
     }
 }
Ejemplo n.º 2
0
        /// <summary>Attempts to find documentation for a given type.</summary>
        ShownDocumentation OpenDocumentation(Type t)
        {
            ShownDocumentation shd = new ShownDocumentation();

            try
            {
                string    Path   = GetXMLDocFilePath(t);
                XDocument xdoc   = XDocument.Load(Path);
                var       fldXel = xdoc.XPathSelectElement("/doc/members/member[@name='T:" + t.FullName + "']");
                try { shd.SummaryXML = fldXel.Element("summary").Value; } catch { }
                try { shd.RemarksXML = fldXel.Element("remarks").Value; } catch { }
            }
            catch (Exception ex) {; }
            return(shd);
        }
Ejemplo n.º 3
0
        /// <summary>Attempts to find documentation for a given type member.</summary>
        ShownDocumentation OpenDocumentation(System.Reflection.MemberInfo mi)
        {
            ShownDocumentation shd = new ShownDocumentation();

            try
            {
                string    Path   = GetXMLDocFilePath(mi.DeclaringType);
                XDocument xdoc   = XDocument.Load(Path);
                var       fldXel = xdoc.XPathSelectElement("/doc/members/member[@name='F:" + mi.DeclaringType.FullName + "." + mi.Name + "']");
                if (fldXel == null)
                {
                    fldXel = xdoc.XPathSelectElement("/doc/members/member[@name='P:" + mi.DeclaringType.FullName + "." + mi.Name + "']");
                }
                try { shd.SummaryXML = fldXel.Element("summary").Value; } catch { }
                try { shd.RemarksXML = fldXel.Element("remarks").Value; } catch { }
            }
            catch (Exception ex) {; }
            return(shd);
        }
Ejemplo n.º 4
0
 static string GetText(ShownDocumentation doc) => "Summary:\t" + (doc.SummaryXML ?? string.Empty) + "\nRemarks" + (doc.RemarksXML ?? string.Empty);