private string GetCategory(ModuleNode module) { var segment = new StringBuilder(); segment.Append("> "); // if (showReportStatus) panel.Append(GetSeverityIcon(module)); segment.Append($"**{module.Name}**"); bool hasSubtitle = !string.IsNullOrWhiteSpace(module.Subtitle); if (hasSubtitle || module.InnerCount > 0) { segment.Append(": "); } if (hasSubtitle) { segment.AppendLine(module.Subtitle); } if (module.InnerCount > 0) { if (hasSubtitle) { segment.Append("> "); } int inserted = 0; foreach (string innerName in GetModuleInnerNames(module)) { if (inserted >= _innerNameLimit) { break; } if (inserted > 0) { segment.Append(" "); } segment.Append(innerName); inserted++; } if (module.InnerCount - inserted > 0) { segment.Append($" (+**{module.InnerCount - inserted}** more)"); } segment.AppendLine(); } else { segment.AppendLine("..."); } return(segment.ToString()); }
private static IEnumerable <string> GetModuleInnerNames(ModuleNode module) { var names = new List <string>(); names.AddRange(module.Commands.Select(x => $"`{x.Name}`")); names.AddRange(module.Submodules.Where(x => x.IsGroup).Select(x => $"`{x.Name}`**\\***")); return(names.OrderBy(x => x.Substring(1))); }
public virtual string OnReadGroup(ModuleNode group) => group.ToString();
public virtual string OnReadModule(ModuleNode module) => module.ToString();