/Console/ConsoleExtensions.cs |
@@ -19,6 +19,7 @@ |
TOP_RIGHT |
} |
|
|
public static void WriteLine(this object data, ConsoleColor foreground, |
ConsoleColor background) |
{ |
@@ -56,10 +57,9 @@ |
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,7 +73,6 @@ |
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(); |
} |
@@ -84,10 +83,9 @@ |
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(); |
} |
@@ -99,7 +97,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; |
@@ -106,10 +104,9 @@ |
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(); |
} |
} |
} |
} |