Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public ConOut Left(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Print($"{line}{" ".Repeat(Console.WindowWidth - line.GetLengthA())}", color);
         return(this);
     }
 }
Ejemplo n.º 3
0
 public ConOut Center(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Print($"{line.Center(Console.WindowWidth)}", color);
         return(this);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 5
0
 public ConOut CoverLeft(string line, ConColor color = null)
 {
     using (new InkScope())
     {
         RowBeginning();
         Console.SetCursorPosition(0, Console.CursorTop);
         Print(line, color);
         return(this);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
 public ConOut Right(string line, ConColor color = null)
 {
     RowBeginning();
     Print($"{" ".Repeat(Console.WindowWidth - line.GetLengthA())}{line}", color);
     return(this);
 }
Ejemplo n.º 8
0
 public ConOut Line(string content, ConColor color = null)
 {
     Print(content, color);
     Console.WriteLine();
     return(this);
 }
Ejemplo n.º 9
0
Archivo: Echo.cs Proyecto: zmjack/Ink
 public static ConOut CoverRight(string line, ConColor color  = null) => Instance.CoverRight(line, color);
Ejemplo n.º 10
0
Archivo: Echo.cs Proyecto: zmjack/Ink
 public static ConOut CoverCenter(string line, ConColor color = null) => Instance.CoverCenter(line, color);
Ejemplo n.º 11
0
Archivo: Echo.cs Proyecto: zmjack/Ink
 public static ConOut Left(string line, ConColor color        = null) => Instance.Left(line, color);
Ejemplo n.º 12
0
Archivo: Echo.cs Proyecto: zmjack/Ink
 public static ConOut Print(string content, ConColor color    = null) => Instance.Print(content, color);
Ejemplo n.º 13
0
Archivo: Echo.cs Proyecto: zmjack/Ink
 public static ConOut Line(string content, ConColor color     = null) => Instance.Line(content, color);