wasSharpNET
/Console/ConsoleExtensions.cs |
@@ -69,7 +69,8 @@ |
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); |
System.Console.WriteLine(data); |
break; |
|
@@ -83,7 +84,8 @@ |
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, foregroundColor); |
break; |
|
@@ -101,7 +103,8 @@ |
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); |
System.Console.Write(data); |
break; |
|
@@ -121,7 +124,8 @@ |
case ConsoleTextAlignment.TOP_CENTER: |
var enumerable = data as IList<object> ?? data.ToList(); |
var textBlock = enumerable.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 enumerable) |
{ |
System.Console.CursorLeft = padding; |
@@ -131,9 +135,7 @@ |
|
case ConsoleTextAlignment.TOP_LEFT: |
foreach (var line in data) |
{ |
WriteLine(line, System.Console.ForegroundColor); |
} |
break; |
|
default: |
@@ -141,4 +143,4 @@ |
} |
} |
} |
} |
} |