예제 #1
0
        public static ConsoleTextDelims ToConsoleTextDelims(this string str)
        {
            var delims = new ConsoleTextDelims(
                $"[{str}->", $"<-{str}]");

            return(delims);
        }
예제 #2
0
 private void WriteTextCore(
     string text,
     ConsoleTextDelims outterDelims,
     string startText = null,
     string endText   = null,
     ConsoleColorsAgg?consoleColors = null,
     bool printTimeStamp            = false)
 {
     WriteObjCore(colors =>
     {
         Write(
             text,
             true,
             colors.MainForeColor,
             true,
             null,
             false,
             printTimeStamp);
     },
                  consoleColors ?? DefaultColors.Data,
                  startText,
                  endText,
                  TextDelims.Text,
                  outterDelims);
 }
예제 #3
0
        private void WriteObjCore(
            Action <ConsoleColorsAgg> mainAction,
            ConsoleColorsAgg colors,
            string startText,
            string endText,
            ConsoleTextDelims mainDelims,
            ConsoleTextDelims outerDelims,
            bool printTimeStamp = false)
        {
            ConsoleColor textColor       = colors.SecondaryForeColor;
            ConsoleColor delimsBackColor = colors.HighlightBackColor;

            PrintTimeStampIfReq(printTimeStamp);

            WriteWithDelims(
                outerDelims.StartDelim,
                null,
                startText,
                textColor,
                delimsBackColor,
                2);

            WriteWithDelims(
                mainDelims.StartDelim,
                null,
                null,
                textColor,
                delimsBackColor,
                1,
                1);

            mainAction(colors);

            WriteWithDelims(
                mainDelims.EndDelim,
                null,
                null,
                textColor,
                delimsBackColor,
                1,
                1);

            WriteWithDelims(
                null,
                outerDelims.EndDelim,
                endText,
                textColor,
                delimsBackColor,
                0,
                2);
        }