예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 /// <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;
 }
예제 #6
0
        /// <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 ;
        }
예제 #7
0
 /// <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;
 }