mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 11:16:59 -04:00
parent
adbe544c57
commit
1976e3ad08
1 changed files with 17 additions and 5 deletions
|
@ -9,19 +9,31 @@ namespace DiscordChatExporter.Cli.Internal
|
||||||
|
|
||||||
public InlineProgress()
|
public InlineProgress()
|
||||||
{
|
{
|
||||||
_posX = Console.CursorLeft;
|
// If output is not redirected - save initial cursor position
|
||||||
_posY = Console.CursorTop;
|
if (!Console.IsOutputRedirected)
|
||||||
|
{
|
||||||
|
_posX = Console.CursorLeft;
|
||||||
|
_posY = Console.CursorTop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Report(double progress)
|
public void Report(double progress)
|
||||||
{
|
{
|
||||||
Console.SetCursorPosition(_posX, _posY);
|
// If output is not redirected - reset cursor position and write progress
|
||||||
Console.WriteLine($"{progress:P1}");
|
if (!Console.IsOutputRedirected)
|
||||||
|
{
|
||||||
|
Console.SetCursorPosition(_posX, _posY);
|
||||||
|
Console.WriteLine($"{progress:P1}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Console.SetCursorPosition(_posX, _posY);
|
// If output is not redirected - reset cursor position
|
||||||
|
if (!Console.IsOutputRedirected)
|
||||||
|
Console.SetCursorPosition(_posX, _posY);
|
||||||
|
|
||||||
|
// Inform about completion
|
||||||
Console.WriteLine("Completed ✓");
|
Console.WriteLine("Completed ✓");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue