Renders XML documentation into a WPF TextBlock.
예제 #1
0
 public void CanRenderDocForHttpRuntimeAppDomainAppId()
 {
     var type = typeof(HttpRuntime);
     var member = type.GetMember("AppDomainAppId")[0];
     var docProvider = XmlDocLoader.LoadDocumentation(member.Module);
     Assert.IsNotNull(docProvider);
     string documentation = docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(member));
     Assert.IsFalse(String.IsNullOrEmpty(documentation));
     var renderer = new XmlDocRenderer();
     renderer.AddXmlDocumentation(documentation);
     var renderedDoc = renderer.CreateTextBlock();
     Assert.IsFalse(String.IsNullOrEmpty(renderedDoc));
 }
예제 #2
0
		public static string GetOpCodeDocumentation(OpCode code) {
			int index = (int)code.Code;
			int hi = index >> 8;
			if (hi == 0xFE)
				index -= 0xFD00;
			else if (hi != 0)
				return null;
			var s = cachedOpCodeDocs[index];
			if (s != null)
				return s;

			var docProvider = XmlDocLoader.MscorlibDocumentation;
			if (docProvider != null) {
				string docXml = docProvider.GetDocumentation("F:System.Reflection.Emit.OpCodes." + code.Code.ToString());
				if (docXml != null) {
					XmlDocRenderer renderer = new XmlDocRenderer();
					renderer.AddXmlDocumentation(docXml);
					return cachedOpCodeDocs[index] = renderer.ToString();
				}
			}

			return null;
		}
예제 #3
0
        private static string GetDoc(MemberInfo member)
        {
            try
            {
                var docProvider = XmlDocLoader.LoadDocumentation(member.Module);
                if (docProvider != null)
                {
                    string documentation = docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(member));
                    if (documentation != null)
                    {
                        var renderer = new XmlDocRenderer();
                        renderer.AddXmlDocumentation(documentation);
                        return renderer.CreateTextBlock();
                    }
                }
            }
            catch
            {
                return "Exception for " + member.Name;
            }

            return String.Empty;
        }