Beispiel #1
0
 public ConsoleProgressBar()
 {
     this.mHConsoleHandle = ConsoleProgressBar.GetStdHandle(-11);
     this.barCoord        = this.GetCursorPos();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
 }
Beispiel #2
0
        public void Update(int transferredBytes, int totalBytes, string message)
        {
            ConsoleProgressBar.COORD cursorPos = this.GetCursorPos();
            this.SetCursorPos(this.barCoord.X, this.barCoord.Y);
            int num;

            if (totalBytes != 0)
            {
                num = (int)((double)transferredBytes * 100.0 / (double)totalBytes);
            }
            else
            {
                num = 0;
            }
            this.progressBar.Length = 0;
            this.progressBar.Append(num);
            this.progressBar.Append("% [");
            for (double num2 = 0.0; num2 < 50.0; num2 += 1.0)
            {
                if (num2 * 2.0 < (double)num)
                {
                    this.progressBar.Append(">");
                }
                else
                {
                    this.progressBar.Append("-");
                }
            }
            this.progressBar.Append("] ");
            if (totalBytes != 0)
            {
                int n  = (int)((double)transferredBytes / 1000.0);
                int n2 = (int)((double)totalBytes / 1000.0);
                this.progressBar.Append(this.comma(n) + "K/" + this.comma(n2) + "K\n");
            }
            else
            {
                this.progressBar.Append("0.0K\n");
            }
            this.progressBar.Append(message);
            this.progressBar.Append("                        \n");
            Console.Write(this.progressBar);
            this.SetCursorPos(cursorPos.X, cursorPos.Y);
        }
Beispiel #3
0
 private static extern int SetConsoleCursorPosition(int hConsoleOutput, ConsoleProgressBar.COORD dwCursorPosition);