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

namespace CommonHelpers {

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

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       [HOptional] int maxCaptionLength )
{
   OutputArrowAlignedCaption(caption,null,maxCaptionLength);
}

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       ConsoleColor? captionColor,
                                       int maxCaptionLength )
{
   OutputArrowAlignedCaption(caption,captionColor,maxCaptionLength,null,null,null);
}

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

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       [HOptional] int maxCaptionLength,
                                       char? dashChar )
{
   OutputArrowAlignedCaption(caption,maxCaptionLength,dashChar,null);
}

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       [HOptional] int maxCaptionLength,
                                       char? dashChar, char? pointerChar )
{
   OutputArrowAlignedCaption(caption,null,maxCaptionLength,dashChar,pointerChar,null);
}

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

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       ConsoleColor? captionColor,
                                       int maxCaptionLength,
                                       char? dashChar )
{
   OutputArrowAlignedCaption(caption,captionColor,maxCaptionLength,dashChar,null);
}

public void OutputArrowAlignedCaption( [HOptional] string caption,
                                       ConsoleColor? captionColor,
                                       int maxCaptionLength,
                                       char? dashChar, char? pointerChar )
{
   OutputArrowAlignedCaption(caption,captionColor,maxCaptionLength,dashChar,pointerChar,null);
}

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

public void OutputArrowAlignedCaption
(
   [HOptional] string caption, ConsoleColor? captionColor, [HOptional] int maxCaptionLength,
   char? dashChar, char? pointerChar, ConsoleColor? arrowColor
)
{
   if (maxCaptionLength<0)
      throw new ArgumentOutOfRangeException();

   caption = caption ?? "";
   arrowColor = arrowColor ?? ArrowedCaptionArrowColor;
   dashChar = dashChar ?? ArrowedCaptionDashChar;

   lock (_InstanceSyncRoot_)
      if (caption=="" && maxCaptionLength==0)
         Output( arrowColor, "{0}{1} ",
            new string( dashChar.Value, ArrowedCaptionDashMinLength ),
            ArrowedCaptionPointerChar );
      else
      {
         Output(captionColor ?? ArrowedCaptionColor,caption);
         Output( arrowColor,
            caption!="" ? " {0}{1} " : "{0}{1} ",
            new string( dashChar.Value,
               ArrowedCaptionDashMinLength +
               HArith.ConfinePositiveOrZero( maxCaptionLength-caption.Length ) ),
            pointerChar ?? ArrowedCaptionPointerChar );
      }
}

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

} // CommonHelpers
