/Console/ConsoleExtensions.cs |
@@ -19,7 +19,6 @@ |
TOP_RIGHT |
} |
|
|
public static void WriteLine(this object data, ConsoleColor foreground, |
ConsoleColor background) |
{ |
@@ -57,9 +56,10 @@ |
switch (alignment) |
{ |
case ConsoleTextAlignment.TOP_CENTER: |
System.Console.CursorLeft = Math.Max(System.Console.WindowWidth/2 - data.ToString().Length/2, 0); |
System.Console.CursorLeft = Math.Max(System.Console.WindowWidth / 2 - data.ToString().Length / 2, 0); |
WriteLine(data, System.Console.ForegroundColor, System.Console.BackgroundColor); |
break; |
|
default: |
throw new NotImplementedException(); |
} |
@@ -73,6 +73,7 @@ |
System.Console.CursorLeft = Math.Max(System.Console.WindowWidth / 2 - data.ToString().Length / 2, 0); |
WriteLine(data, foregroundColor, System.Console.BackgroundColor); |
break; |
|
default: |
throw new NotImplementedException(); |
} |
@@ -83,9 +84,10 @@ |
switch (alignment) |
{ |
case ConsoleTextAlignment.TOP_CENTER: |
System.Console.CursorLeft = Math.Max(System.Console.WindowWidth/2 - data.ToString().Length/2, 0); |
System.Console.CursorLeft = Math.Max(System.Console.WindowWidth / 2 - data.ToString().Length / 2, 0); |
Write(data, System.Console.ForegroundColor, System.Console.BackgroundColor); |
break; |
|
default: |
throw new NotImplementedException(); |
} |
@@ -97,7 +99,7 @@ |
{ |
case ConsoleTextAlignment.TOP_CENTER: |
var textBlock = data.Select(o => o.ToString()).ToArray(); |
var padding = Math.Max(System.Console.WindowWidth/2 - textBlock.Select(o => o.Length).Max()/2, 0); |
var padding = Math.Max(System.Console.WindowWidth / 2 - textBlock.Select(o => o.Length).Max() / 2, 0); |
foreach (var line in data) |
{ |
System.Console.CursorLeft = padding; |
@@ -104,9 +106,10 @@ |
WriteLine(line, System.Console.ForegroundColor, System.Console.BackgroundColor); |
} |
break; |
|
default: |
throw new NotImplementedException(); |
} |
} |
} |
} |
} |
/Console/ConsoleSpin.cs |
@@ -19,7 +19,7 @@ |
public class ConsoleSpin : IDisposable |
{ |
private static readonly CircularQueue<string> spinArt = |
new CircularQueue<string>(new[] {".oOo", "oOo.", "Oo.o", "o.oO"}); |
new CircularQueue<string>(new[] { ".oOo", "oOo.", "Oo.o", "o.oO" }); |
|
private static readonly ManualResetEvent spinEvent = new ManualResetEvent(false); |
private static Thread spinThread; |
@@ -86,4 +86,4 @@ |
spinEvent.Reset(); |
} |
} |
} |
} |