Пример #1
0
 public static bool Ask()
 {
     Console.Write("(Yes = "); ColorLine.WriteC("Y", ConsoleColor.Green);
     Console.Write(")/(No = ");
     ColorLine.WriteC("Another One", ConsoleColor.Red); Console.Write("): ");
     return(Console.ReadKey().KeyChar.ToString().ToLower().Equals("y"));
 }
Пример #2
0
        private void PrintProgressBar(double pasentto)
        {
            // Generate new state
            int    width               = (int)(pasentto / 100 * barLength);
            int    fill                = barLength - width;
            int    pasenttoLength      = pasentto < 10 ? 3 : (pasentto >= 10 && pasentto < 100) ? 4 : 5;
            string charEmpyInStartLine = pasentto < 10 ? "  " : (pasentto >= 10 && pasentto < 100) ? " " : "";

            Console.Write(" => " + charEmpyInStartLine + "{0:0.0}% [ ", pasentto);
            ColorLine.WriteC(string.Empty.PadLeft(width, CharProgress), ConsoleColor.Green); Console.Write("{0} ] - ", string.Empty.PadLeft(fill, ' '));
            LastOutputLength = 4 + charEmpyInStartLine.Length + pasenttoLength + "% [ ".Length + barLength + " ] - ".Length;
        }
Пример #3
0
        public void PrintProgressPrecentUpdating()
        {//this method need a percent with auto update
            Console.CursorVisible = false;
            double pasentto = 0;

            PrintProgressBar(pasentto);
            while (pasentto <= 100)
            {
                pasentto = Percent;
                DeleteLastLine();
                PrintProgressBar(pasentto);
            }
            ColorLine.WriteC(" DONE", ConsoleColor.Green); Console.WriteLine('!');
            Console.CursorVisible = true;
        }