Add project files.
This commit is contained in:
27
PluginManager/Items/CustomProgressBar.cs
Normal file
27
PluginManager/Items/CustomProgressBar.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
namespace PluginManager.Items
|
||||
{
|
||||
public class CustomProgressBar
|
||||
{
|
||||
private const char _block = '#';
|
||||
private const char _emptyBlock = ' ';
|
||||
private const char _leftMargin = '[';
|
||||
private const char _rightMargin = ']';
|
||||
|
||||
const string _back = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
|
||||
public static void WriteProgressBar(int percent)
|
||||
{
|
||||
Console.Write(_back);
|
||||
Console.Write(_leftMargin);
|
||||
var p = (int)((percent / 10f) + .5f);
|
||||
for (var i = 0; i < 10; ++i)
|
||||
{
|
||||
if (i >= p)
|
||||
Console.Write(_emptyBlock);
|
||||
else
|
||||
Console.Write(_block);
|
||||
}
|
||||
Console.Write($"{_rightMargin} " + percent + " %");
|
||||
}
|
||||
}
|
||||
}
|
||||
40
PluginManager/Items/Spinner.cs
Normal file
40
PluginManager/Items/Spinner.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PluginManager.Items
|
||||
{
|
||||
public class Spinner
|
||||
{
|
||||
public bool isSpinning;
|
||||
|
||||
public Spinner()
|
||||
{
|
||||
isSpinning = false;
|
||||
}
|
||||
|
||||
public async void Start()
|
||||
{
|
||||
isSpinning = true;
|
||||
int cnt = 0;
|
||||
|
||||
while (isSpinning)
|
||||
{
|
||||
cnt++;
|
||||
switch (cnt % 4)
|
||||
{
|
||||
case 0: Console.Write("/"); break;
|
||||
case 1: Console.Write("-"); break;
|
||||
case 2: Console.Write("\\"); break;
|
||||
case 3: Console.Write("|"); break;
|
||||
}
|
||||
Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
isSpinning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user