Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

C# Console progress-bar

Download: GIST

[Image: N4eW6ck.gif]

A simple progressbar for console applications.

Example code used in gif can be found in the gist.

Disposing of the ConsoleProgressBar will erase the progress bar from the screen. So make sure you dispose when finished.

This will most likely have issues if you print anything except string or int while progress bar is active. If you want to solve this, add the
Code
public override void WriteLine
public override void Write
for the types you want to print to the bottom of the file (as seen here)
Lotta blood to let, peace to make, give a fuk about a check
Nice share Bah! Code looks clean how'd you got the idea for this as I've never really seen it before while it's really practical for console apps!
Looks great, always wanted to do this for my mini-console tools but I've always been too lazy.

(Nov 7, 2017 05:11 PM)warpje Wrote:  Nice share Bah! Code looks clean how'd you got the idea for this as I've never really seen it before while it's really practical for console apps!

If I had to guess, he probably got inspiration from some of the Linux apps such as apt or wget:
[img]http://www.omgubuntu.co.uk/wp-content/uploads/2014/04/apt-progress.png[/img]
(Nov 7, 2017 06:09 PM)Джеймс Wrote:  Looks great, always wanted to do this for my mini-console tools but I've always been too lazy.


If I had to guess, he probably got inspiration from some of the Linux apps such as apt or wget:
[img]http://www.omgubuntu.co.uk/wp-content/uploads/2014/04/apt-progress.png[/img]

Ah yeah didn't think about that! Thanks for the screen ;)
(Nov 7, 2017 06:09 PM)Джеймс Wrote:  Looks great, always wanted to do this for my mini-console tools but I've always been too lazy.


If I had to guess, he probably got inspiration from some of the Linux apps such as apt or wget:
[img]http://www.omgubuntu.co.uk/wp-content/uploads/2014/04/apt-progress.png[/img]
Hahaha that's what I was thinking reading the op lol, nice job tho, Ill probably be using this in the future :)

<3
Is this thread safe? I mean, you use Console.SetCursorPosition, doesn't look thread safe.
(Nov 8, 2017 05:40 AM)Ninja Wrote:  Is this thread safe? I mean, you use Console.SetCursorPosition, doesn't look thread safe.

It is now
Lotta blood to let, peace to make, give a fuk about a check
(Nov 8, 2017 04:07 PM)BahNahNah Wrote:  It is now

Your code might benefit from delegating things to master functions that achieve a higher purpose. That way you don't have locks all over the place and boilerplate code. I find this to be the most sensible approach when doing more advanced things to avoid deadlocks and such. Plus it makes the code better to read and easier to maintain...
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
Nice release sir.
#MakeConsoleGreatAgain
#BahNahNah4President.

(Nov 8, 2017 06:55 PM)0xDEAD10CC Wrote:  Your code might benefit from delegating things to master functions that achieve a higher purpose. That way you don't have locks all over the place and boilerplate code. I find this to be the most sensible approach when doing more advanced things to avoid deadlocks and such. Plus it makes the code better to read and easier to maintain...

I love to read your pretty well constructive opinion on every thread. Thanks for it.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Freed0m36Nov 22, 2018 02:59 AM 7 203 Nov 22, 2018 02:59 AM
Last Post: PoP-Hacker
[Shell] by HackooMar 29, 2018 04:04 AM 5 289 Mar 29, 2018 04:04 AM
Last Post: Hackoo
[.NET] by FortiondFeb 2, 2017 04:58 AM 12 1,091 Feb 2, 2017 04:58 AM
Last Post: PVPMinersDE