private static void PrintEnum(StringBuilder b, EnumTypeDoc type) { b.AppendLine("<div style=\"line-height: 1;\">"); b.AppendLine("\t<h2 markdown=\"1\">" + Utils.GetSafeTypeName(type.Type, true) + " ``enum``</h2>"); b.AppendLine("\t<p style=\"font-size: 20px;\"><b>Namespace:</b> " + type.Namespace + "</p>"); b.AppendLine("\t<p style=\"font-size: 20px;\"><b>Assembly:</b> MLAPI.dll</p>"); b.AppendLine("</div>"); b.AppendLine("<p>" + type.Summary + "</p>"); b.AppendLine("<div>"); b.AppendLine("\t<h3 markdown=\"1\">Enum Values</h3>"); for (int i = 0; i < type.Values.Count; i++) { b.AppendLine("\t<div>"); b.AppendLine("\t\t<h4 markdown=\"1\"><b>``" + type.Values[i].Name + "``</b></h4>"); b.AppendLine("\t\t<p>" + type.Values[i].Summary + "</p>"); b.AppendLine("\t</div>"); } b.AppendLine("</div>"); }
private void ParseEnum(Type type, XmlDocTree xmlDocTree) { EnumTypeDoc enumType = new EnumTypeDoc() { Name = type.Name, Type = type, Namespace = type.Namespace }; foreach (string name in type.GetEnumNames()) { EnumDoc enumValue = new EnumDoc() { Name = name }; DocMember member = xmlDocTree.GetDocumentationEnumValue(type, name); if (member != null) { enumValue.Summary = member.Summary; } enumType.Values.Add(enumValue); } { DocMember member = xmlDocTree.GetDocumentation(type); if (member != null) { enumType.Summary = member.Summary; } } docTypes.Add(enumType); }
public static void Print(DocTree tree, string yamlPath, string apiFolder) { List <DocType> apis = new List <DocType>(); for (int i = 0; i < tree.docTypes.Count; i++) { if (tree.docTypes[i] is ClassTypeDoc) { ClassTypeDoc type = (ClassTypeDoc)tree.docTypes[i]; apis.Add(type); StringBuilder b = new StringBuilder(); b.AppendLine("---"); b.AppendLine("title: " + Utils.GetSafeTypeName(type.Type, true)); b.AppendLine("name: " + Utils.GetSafeTypeName(type.Type, false)); b.AppendLine("permalink: " + Utils.GetRelativeApiUrl(type.Type)); b.AppendLine("---"); b.AppendLine(); PrintClass(b, type, tree); File.WriteAllText(Path.Combine(apiFolder, Utils.GetSafeTypeName(type.Type, false).Replace("<", "_").Replace(">", "_") + ".md"), b.ToString()); } else if (tree.docTypes[i] is EnumTypeDoc) { EnumTypeDoc type = (EnumTypeDoc)tree.docTypes[i]; apis.Add(type); StringBuilder b = new StringBuilder(); b.AppendLine("---"); b.AppendLine("title: " + Utils.GetSafeTypeName(type.Type, true)); b.AppendLine("name: " + Utils.GetSafeTypeName(type.Type, false)); b.AppendLine("permalink: " + Utils.GetRelativeApiUrl(type.Type)); b.AppendLine("---"); b.AppendLine(); PrintEnum(b, type); File.WriteAllText(Path.Combine(apiFolder, Utils.GetSafeTypeName(type.Type, false).Replace("<", "_").Replace(">", "_") + ".md"), b.ToString()); } else if (tree.docTypes[i] is StructDocType) { StructDocType type = (StructDocType)tree.docTypes[i]; apis.Add(type); StringBuilder b = new StringBuilder(); b.AppendLine("---"); b.AppendLine("title: " + Utils.GetSafeTypeName(type.Type, true)); b.AppendLine("name: " + Utils.GetSafeTypeName(type.Type, false)); b.AppendLine("permalink: " + Utils.GetRelativeApiUrl(type.Type)); b.AppendLine("---"); b.AppendLine(); PrintStruct(b, type, tree); File.WriteAllText(Path.Combine(apiFolder, Utils.GetSafeTypeName(type.Type, false).Replace("<", "_").Replace(">", "_") + ".md"), b.ToString()); } } StringBuilder builder = new StringBuilder(); WriteYaml(builder, apis); File.WriteAllText(yamlPath, builder.ToString()); }