-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConversionStatusText.cs
39 lines (35 loc) · 1013 Bytes
/
ConversionStatusText.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
namespace VideoMinify
{
public class ConversionStatusText
{
private int yPos;
private string loadingChars = "/-\\|";
private int counter = 0;
private string textToDisplay;
public ConversionStatusText(int yPos, string textToDisplay)
{
this.yPos = yPos;
this.textToDisplay = textToDisplay;
}
public void Update(bool isDone)
{
if (isDone)
{
Console.SetCursorPosition(0,yPos);
Console.WriteLine("Working on {0} ... {1}",textToDisplay, "Done!");
}
else
{
Console.SetCursorPosition(0,yPos);
Console.WriteLine("Working on {0} ... {1}",textToDisplay, GetChar(counter%4));
counter += 1;
}
}
private char GetChar(int count)
{
return loadingChars[count];
}
}
}