Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a fancier Console library for C#? [closed]

Tags:

c#

.net

Is there any library for .NET which can:

  • output characters/words in color
  • draw stuff in console like progress bars (similar to wget)
  • other funny beautiful things i might consider using in my glamor console app
like image 906
Ivan G. Avatar asked Apr 28 '11 18:04

Ivan G.


3 Answers

Yes; the Console class can do all of that.

  • Set Console.ForegroundColor
  • Print Unicode Box Drawing Characters and set CursorLeft and CursorTop
  • Such as?
like image 120
SLaks Avatar answered Nov 17 '22 08:11

SLaks


ConsoleEx

The ConsoleEx library, written a long time ago by Microsoftie, Tim Sneath, can do some advanced coloring and writing to positions. It's generally a lot better than the Console, even the .NET 4.0 Console (as far as I can tell).

And it's on NuGet!

like image 43
Anthony Mastrean Avatar answered Nov 17 '22 07:11

Anthony Mastrean


I have had a bit of success with a progress indicator. This block is called from an event and may be called from multiple threads. it displays 1% and increments as appropriate on one line.

private object thislock = new Object();
void UpdateProgress(DownloadProgressChangedEventArgs e)
{
    lock (thislock)
    {
        for (int i = 0; i < 50; i++)
        {
            Console.Write("\b");
        }
        Console.Write(e.ProgressPercentage.ToString() + "%");
    }
}
like image 44
jlo-gmail Avatar answered Nov 17 '22 07:11

jlo-gmail