74 lines
1.6 KiB
C#
74 lines
1.6 KiB
C#
|
namespace InnovEnergy.SysTools.Utils;
|
||
|
|
||
|
internal static class ConsoleUtils
|
||
|
{
|
||
|
public static T WriteLine<T>(this T t, ConsoleColor color)
|
||
|
{
|
||
|
var c = Console.ForegroundColor;
|
||
|
|
||
|
Console.ForegroundColor = color;
|
||
|
Console.WriteLine(t);
|
||
|
Console.ForegroundColor = c;
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T WriteLine<T>(this T t)
|
||
|
{
|
||
|
Console.WriteLine(t);
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T WriteLine<T>(this T t, ConsoleColor color, params String[] more)
|
||
|
{
|
||
|
var c = Console.ForegroundColor;
|
||
|
|
||
|
Console.ForegroundColor = color;
|
||
|
Console.WriteLine(t + " " + more.JoinWith(" "));
|
||
|
Console.ForegroundColor = c;
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T WriteLine<T>(this T t, params String[] more)
|
||
|
{
|
||
|
Console.WriteLine(t + " " + more.JoinWith(" "));
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static T Write<T>(this T t, ConsoleColor color)
|
||
|
{
|
||
|
var c = Console.ForegroundColor;
|
||
|
|
||
|
Console.ForegroundColor = color;
|
||
|
Console.Write(t);
|
||
|
Console.ForegroundColor = c;
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T Write<T>(this T t)
|
||
|
{
|
||
|
Console.Write(t);
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T Write<T>(this T t, ConsoleColor color, params String[] more)
|
||
|
{
|
||
|
var c = Console.ForegroundColor;
|
||
|
|
||
|
Console.ForegroundColor = color;
|
||
|
Console.Write(t + " " + more.JoinWith(" "));
|
||
|
Console.ForegroundColor = c;
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static T Write<T>(this T t, params String[] more)
|
||
|
{
|
||
|
Console.Write(t + " " + more.JoinWith(" "));
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
}
|