Example #1
0
        public ConOut CoverCenter(string line, ConColor color = null)
        {
            using (new InkScope())
            {
                var len = line.GetLengthA();
                int left;
                if (Console.WindowWidth <= len)
                {
                    left = 0;
                }
                else
                {
                    var total = Console.WindowWidth - len;
                    left = total / 2;
                    if (total.IsOdd())
                    {
                        left += 1;
                    }
                }

                RowBeginning();
                Console.SetCursorPosition(left, Console.CursorTop);
                Print(line, color);
                return(this);
            }
        }
Example #2
0
 public ConOut Left(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Print($"{line}{" ".Repeat(Console.WindowWidth - line.GetLengthA())}", color);
         return(this);
     }
 }
Example #3
0
 public ConOut Center(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Print($"{line.Center(Console.WindowWidth)}", color);
         return(this);
     }
 }
Example #4
0
 public ConOut CoverRight(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Console.SetCursorPosition(Console.WindowWidth - line.GetLengthA(), Console.CursorTop);
         Print(line, color);
         return(this);
     }
 }
Example #5
0
 public ConOut CoverLeft(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Console.SetCursorPosition(0, Console.CursorTop);
         Print(line, color);
         return(this);
     }
 }
Example #6
0
        public ConOut Print(string content, ConColor color = null)
        {
            void Process()
            {
                Console.Write(content);
            }

            if (color is null)
            {
                Process();
            }
            else
            {
                var originColor = ConColor;
                ConColor = color;
                Process();
                ConColor = originColor;
            }

            return(this);
        }
Example #7
0
 public ConOut Right(string line, ConColor color = null)
 {
     RowBeginning();
     Print($"{" ".Repeat(Console.WindowWidth - line.GetLengthA())}{line}", color);
     return(this);
 }
Example #8
0
 public ConOut Line(string content, ConColor color = null)
 {
     Print(content, color);
     Console.WriteLine();
     return(this);
 }
Example #9
0
File: Echo.cs Project: zmjack/Ink
 public static ConOut CoverRight(string line, ConColor color  = null) => Instance.CoverRight(line, color);
Example #10
0
File: Echo.cs Project: zmjack/Ink
 public static ConOut CoverCenter(string line, ConColor color = null) => Instance.CoverCenter(line, color);
Example #11
0
File: Echo.cs Project: zmjack/Ink
 public static ConOut Left(string line, ConColor color        = null) => Instance.Left(line, color);
Example #12
0
File: Echo.cs Project: zmjack/Ink
 public static ConOut Print(string content, ConColor color    = null) => Instance.Print(content, color);
Example #13
0
File: Echo.cs Project: zmjack/Ink
 public static ConOut Line(string content, ConColor color     = null) => Instance.Line(content, color);