/// <summary> /// Generates property manual /// </summary> /// <param name="dataObject">The data object.</param> /// <param name="output">The output.</param> public static void GetUserManual(this Object dataObject, ITextRender output, String directInfo = "", Boolean skipUnDescribed = true, Boolean showValue = true) { settingsEntriesForObject seo = new settingsEntriesForObject(dataObject, false, false); String heading = ""; if (!seo.Category.isNullOrEmpty()) { heading += seo.Category + ": "; } output.AppendHeading(heading + seo.DisplayName, 2); List <String> description = new List <string>(); if (!seo.Description.isNullOrEmpty()) { output.AppendSection(seo.Description, "Class: " + dataObject.GetType().Name, dataObject.GetType().Namespace, seo.additionalInfo); } if (!directInfo.isNullOrEmpty()) { output.AppendComment(directInfo); } var list = seo.spes.Values.ToList().OrderBy(x => x.categoryName); foreach (settingsPropertyEntryWithContext spec in list) { if (spec.description.isNullOrEmpty() && skipUnDescribed) { } else { output.AppendHeading(imbSciStringExtensions.add(spec.categoryName, spec.displayName, ": "), 3); output.AppendPair("Property name: ", spec.pi.Name); output.AppendPair("Type: ", spec.pi.PropertyType.Name); if (!spec.description.isNullOrEmpty()) { output.AppendParagraph(spec.description); } if (!spec.letter.isNullOrEmpty()) { output.AppendPair("Annotation: ", spec.letter); } if (!spec.unit.isNullOrEmpty()) { output.AppendPair("Unit: ", spec.unit); } if (spec.aggregation != null) { output.AppendPair("Aggregation: ", spec.aggregation.multiTableType.ToString()); } if (showValue) { if (spec.value != null) { output.AppendPair("Value: ", spec.value.toStringSafe(spec.format)); } } if (spec.type.IsEnum) { output.AppendPair("Possible values: ", spec.type.GetEnumNames().toCsvInLine()); } else if (spec.type == typeof(Int32)) { } if (!spec.info_helpTitle.isNullOrEmpty()) { output.AppendLabel(spec.info_helpTitle); output.AppendQuote(spec.info_helpTips); } if (!spec.info_link.isNullOrEmpty()) { output.AppendLink(spec.info_link, "More", "More"); } output.AppendHorizontalLine(); } } if (!seo.info_helpTitle.isNullOrEmpty()) { output.AppendLabel(seo.info_helpTitle); output.AppendQuote(seo.info_helpTips); } if (!seo.info_link.isNullOrEmpty()) { output.AppendLink(seo.info_link, "More", "More"); } }
public static void ReportCommandDesc(this commandTreeDescription item, ITextRender output, String cTitlePrefix = "") { String cTitle = cTitlePrefix; cTitle = cTitle.add(item.name, ".").Trim('.'); //node.item.menuMeta[aceMenuItemAttributeRole.Category] // cTitle = node.item.menuMeta.getEntrySafe(aceMenuItemAttributeRole.Category).add(cTitle, "."); String k = item.menuMeta.getEntrySafe(aceMenuItemAttributeRole.Key); if (!k.isNullOrEmpty()) { if (k.Length < 5) { cTitle = cTitle.add(" [" + k + "]"); } } //node.item.menuMeta.getp output.open("div", cTitle, item.description); //output.AppendPair("Caption", node.item.name, true, ": "); foreach (var pair in item.menuMeta) { if (imbSciStringExtensions.isNullOrEmpty(pair.Value)) { } else { switch (pair.Key) { case aceMenuItemAttributeRole.aliasNames: output.AppendPair("Alias", pair.Value, true, ": "); break; case aceMenuItemAttributeRole.Description: case aceMenuItemAttributeRole.ExpandedHelp: output.AppendComment(pair.Value); break; case aceMenuItemAttributeRole.Key: // output.AppendPair("Shortcut / key", pair.Value, true, ": "); break; case aceMenuItemAttributeRole.Category: case aceMenuItemAttributeRole.DisplayName: case aceMenuItemAttributeRole.CmdParamList: break; default: output.AppendPair(pair.Key.ToString(), pair.Value, true, ": "); break; } } } String example = item.name + " "; if (item.menuMeta.cmdParams != null) { if (item.menuMeta.cmdParams.Any()) { output.AppendLabel("Command arguments: "); String parLine = ""; Int32 pi = 1; List <String> prl = new List <string>(); parLine = item.menuMeta.cmdParams.ToString(false, true, true); //foreach (typedParam cmdpar in node.item.menuMeta.cmdParams) //{ // parLine = parLine.add(cmdpar.getString(false), ";"); //} output.AppendTable(item.menuMeta.cmdParams.getParameterTable()); example = example + parLine; } } output.AppendLabel("Example : "); output.AppendCode(example); output.close(); }