//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;

namespace CommonHelpers {

//**************************************************************************************************
partial class HConsole {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public void PrintNumberedList(bool insertBlankLine,[HOptional] string caption,string[] values)
{
   PrintListCaption( insertBlankLine, caption );
   PrintNumberedList( false, values );
}

//==================================================================================================

public void PrintNumberedList(bool insertBlankLine,string[] values)
{
   PrintNumberedList(insertBlankLine,values,null);
}

public void PrintNumberedList( bool insertBlankLine, string[] values,
                               [HOptional] ConsoleColor? valueColor )
{
   PrintNumberedList(insertBlankLine,values,valueColor,null);
}

//--------------------------------------------------------------------------------------------------

public void PrintNumberedList( bool insertBlankLine, string[] values,
                               [HOptional] ConsoleColor? valueColor,
                               [HOptional] ConsoleColor? numberColor )
{
   PrintNumberedList(insertBlankLine,values,valueColor,numberColor,null);
}

public void PrintNumberedList( bool insertBlankLine, string[] values,
                               [HOptional] ConsoleColor? valueColor,
                               [HOptional] ConsoleColor? numberColor,
                               [HOptional] string numberValueSeparator )
{
   PrintNumberedList(insertBlankLine,values,valueColor,numberColor,numberValueSeparator,null);
}

//--------------------------------------------------------------------------------------------------

public void PrintNumberedList( bool insertBlankLine, string[] values,
                               [HOptional] ConsoleColor? valueColor,
                               [HOptional] ConsoleColor? numberColor,
                               [HOptional] string numberValueSeparator,
                               [HOptional] ConsoleColor? numberValueSeparatorColor )
{
   HArgChecking.VerifyNotNulls( values );
   if (values.Length==0)
      throw HArgChecking.ArgumentException_IncorrectArguments;

   int itemCount = values.Length;
   var numCaptions = new string[ itemCount ];
   int maxNumberWidth = HInt32.ToNormalString( itemCount ).Length;

   for (int i=0; i<itemCount; i++)
      numCaptions[i] = HInt32.ToNormalString( i+1 ).PadLeft( maxNumberWidth );

   numberColor = numberColor ?? ListItemNumberColor;

   PrintAlignedList( insertBlankLine,
      numCaptions, numberColor,
      values, valueColor ?? ListItemNumberedValueColor,
      null, null,
      numberValueSeparator ?? ListItemNumberValueSeparator,
      numberValueSeparatorColor ?? ListItemNumberValueSeparatorColor ?? numberColor );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HConsole
//**************************************************************************************************

} // CommonHelpers
