Recently I needed to show some progress indicator on some long running console application. I recall the good old days of my college days with console based SMTP clients such as elm and pine… as I recall these clients showed progress via a simple ASCII spiner.
I was impressed with how simple this is to do with .NET Framework 2.0.. I started off writing the usage code I wanted to enable, then built a simple class that meet those requirements.. I highly recommend this process especially for more complex designs.
Here is the client code:
static void Main(string args)
ConsoleSpiner spin = new ConsoleSpiner();
And here is the class I came up with.
public class ConsoleSpiner
counter = 0;
public void Turn()
switch (counter % 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);
PS – does anyone still use elm\pine? Are their clients that work with exchange? Also, I was always told that pine was an acronym for “Pine Is Not Elm”, but accounting to the official site it is not.