/// <summary> /// Returns help line contains application name /// </summary> /// <returns></returns> private string GetHelpApplicationName() { var text = GetSettingsApplicationName() + " - "; var frmt = new TextBuilder.DrCmdTextBuilderFormat(0, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); text += builder.BuildText(GetSettingsApplicationDescription()); return(text); }
/// <summary> /// Returns help line contains application synopsis like 'Application.exe - {COMMAND1 | COMMAND2}' /// </summary> /// <returns></returns> private string GetHelpSynopsis() { var tab = GetHelpTab(); var text = tab + GetSettingsApplicationName() + " "; var frmt = new TextBuilder.DrCmdTextBuilderFormat(text.Length, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); text += builder.BuildText("{" + GetCommandsNamesForHelp() + "}"); return(text); }
/// <summary> /// Returns help lines contains command description like /// COMMAND1 - it's command 1 /// COMMAND2 - it's command 2 /// </summary> /// <returns></returns> private string GetHelpCommandsDescriptions() { var text = string.Empty; var tab = GetHelpTab(); var maxCommandNameLength = this.GetMaximumCommandNameLength() + 1; var leftMargin = tab.Length + maxCommandNameLength; var frmt = new TextBuilder.DrCmdTextBuilderFormat(leftMargin, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); foreach (var command in Commands) { if (command.IsEnabled()) { text += tab + command.Name + (new string(' ', maxCommandNameLength - command.Name.Length)) + builder.BuildText(command.GetCommandDescription()); } } return(text); }
public void TestBuildTextJustifyTrue() { var marginLeft = 10; var textWidth = 80; var justify = true; var drTextFormat = new DrCmdTextBuilderFormat(marginLeft, textWidth, justify, false); var drCmdTextBuilder = new DrCmdTextBuilder(drTextFormat); var result = drCmdTextBuilder.BuildText(textSample1); ValidateFormatedText(drTextFormat, textSample1, result); }
/// <summary> /// Returns help line contains application synopsis like 'Application.exe - {COMMAND1 | COMMAND2}' /// </summary> /// <returns></returns> private string GetHelpSynopsis() { var tab = GetHelpTab(); var text = tab + GetSettingsApplicationName() + " "; var frmt = new TextBuilder.DrCmdTextBuilderFormat(text.Length, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); text+=builder.BuildText("{" + GetCommandsNamesForHelp() + "}"); return text; }
/// <summary> /// Returns help lines contains command description like /// COMMAND1 - it's command 1 /// COMMAND2 - it's command 2 /// </summary> /// <returns></returns> private string GetHelpCommandsDescriptions() { var text = string.Empty; var tab = GetHelpTab(); var maxCommandNameLength = this.GetMaximumCommandNameLength()+1; var leftMargin = tab.Length + maxCommandNameLength ; var frmt = new TextBuilder.DrCmdTextBuilderFormat(leftMargin, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); foreach (var command in Commands) { if (command.IsEnabled()) { text += tab + command.Name + (new string(' ', maxCommandNameLength - command.Name.Length)) + builder.BuildText(command.GetCommandDescription()) ; } } return text ; }
/// <summary> /// Returns help line contains application name /// </summary> /// <returns></returns> private string GetHelpApplicationName() { var text = GetSettingsApplicationName() + " - "; var frmt = new TextBuilder.DrCmdTextBuilderFormat(0, GetSettingsHelpMaxLineLength(), true, true); var builder = new TextBuilder.DrCmdTextBuilder(frmt); text += builder.BuildText(GetSettingsApplicationDescription()); return text; }