![]() |
|
[C#] C# Console progress-bar - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] C# Console progress-bar (/showthread.php?tid=5740295) |
C# Console progress-bar - BahNahNah - Oct 19, 2017 Download: GIST ![]() 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 WriteLineRE: C# Console progress-bar - warpje - Nov 7, 2017 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! RE: C# Console progress-bar - Джеймс - Nov 7, 2017 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] RE: C# Console progress-bar - warpje - Nov 7, 2017 (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. Ah yeah didn't think about that! Thanks for the screen ;) RE: C# Console progress-bar - NinjaLeaks - Nov 7, 2017 (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.Hahaha that's what I was thinking reading the op lol, nice job tho, Ill probably be using this in the future :) RE: C# Console progress-bar - Ninja - Nov 8, 2017 Is this thread safe? I mean, you use Console.SetCursorPosition, doesn't look thread safe. RE: C# Console progress-bar - BahNahNah - Nov 8, 2017 (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 RE: C# Console progress-bar - 0xDEAD10CC - Nov 8, 2017 (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... RE: C# Console progress-bar - Rigg - Nov 8, 2017 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. |