Пример #1
0
		static string Generate(TypeDom type)
		{
			XElement body;
			var doc = GetDoc(out body);
			
			body.Add(
				x("h1", type.GetDisplayName(false) + Names[Strings.SuffixDelimeter] + Names[type.TypeKind.ToString()]),
				x("p", XMLUtils.GetTagInnerXml(type.DocInfo, "summary", Navigation, true)),
				InheritanceSection(type),
				NamespaceAssembly(type.Type),
				GenerateSyntax(type),
				BuldParameters(Names[Strings.TypeParameters], type.GenericTypeParameters)
			);
			
			for (int i = 0; i <= (int)MemberTypeSection.Events; i++)
			{
				body.Add(BuildMembers((MemberTypeSection)i, type));
			}

			body.Add(BuildEnding(type.Assembly, type.DocInfo));

			return doc.ToString();
		}
Пример #2
0
		static XElement InheritanceSection(TypeDom type)
		{
			if (type.Type.IsValueType || type.Type.IsEnum || type.Type.IsInterface || type.Type.IsSubclassOf(typeof(Delegate)))
				return x("div");

			var space = string.Empty;
			var content = new XElement("div");
			var baseTypes = type.BaseTypes;
			var derivedTypes = type.DerivedTypes;

			if (baseTypes.Length == 0 && derivedTypes.Length == 0)
				return null;

			foreach (var baseType in baseTypes)
			{
				content.Add(space, BuildTypeUrl(baseType), x("br"));
				space += Nbsp + Nbsp;
			}

			content.Add(x("b", space + type.GetDisplayName(true)), x("br"));
			space += Nbsp + Nbsp;

			foreach (var derivedType in derivedTypes)
				content.Add(space, BuildTypeUrl(derivedType), x("br"));

			return Section(Names[Strings.InheritanceHierarchy], content, a("class", "doc_inheritance"));
		}