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

namespace CommonHelpers {

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

public void PrintDialogKeysLegend( bool insertBlankLine,
                                   string[] actions,
                                   ConsoleKey[] keyArray )
{
   PrintDialogKeysLegend( insertBlankLine, null, actions, keyArray );
}

public void PrintDialogKeysLegend( bool insertBlankLine,
                                   string[] actions, ConsoleKey[] keyArray,
                                   [HOptional] ConsoleModifiers[] modifierArray )
{
   PrintDialogKeysLegend( insertBlankLine, null, actions, keyArray, modifierArray );
}

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

public void PrintDialogKeysLegend( bool insertBlankLine, [HOptional] string caption,
                                   string[] actions, ConsoleKey[] keyArray )
{
   PrintDialogKeysLegend( insertBlankLine, caption, actions, keyArray, null );
}

public void PrintDialogKeysLegend( bool insertBlankLine, [HOptional] string caption,
                                   string[] actions, ConsoleKey[] keyArray,
                                   [HOptional] ConsoleModifiers[] modifierArray )
{
   if ( keyArray.Length==0 ||
        modifierArray!=null && modifierArray.Length!=keyArray.Length ||
        actions.Length!=keyArray.Length )
      throw HArgChecking.ArgumentException_IncorrectArguments;

   if (insertBlankLine)
      Print();
   if (caption!=null)
      PrintInformationCaption( caption );

   int itemCount = keyArray.Length;

   var keyStrings = new string[ itemCount ];
   for (int i=0; i<keyStrings.Length; i++)
      keyStrings[i] = KeyToString( HArray.GetAtZeroBasedIndex(keyArray,i),
         modifierArray!=null ? HArray.GetAtZeroBasedIndex(modifierArray,i) : 0 );

   PrintDashAlignedList(
      keyStrings, DialogKeyColor,
      actions, DialogActionColor );
}

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

} // CommonHelpers
