replace v6 with experimental v7 code

This commit is contained in:
stax76
2023-10-24 11:17:45 +02:00
parent fb27bb8727
commit 5706d7b66d
212 changed files with 15014 additions and 12173 deletions

40
src/MpvNet/Terminal.cs Normal file
View File

@@ -0,0 +1,40 @@

namespace MpvNet;
public static class Terminal
{
static int Padding { get; } = 60;
public static void WriteError(object obj, string module = "mpv.net") => Write(obj, module, ConsoleColor.DarkRed, false);
public static void Write(object obj, string module = "mpv.net") => Write(obj, module, ConsoleColor.Black, true);
public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor)
{
string text = obj + "";
if (text == "")
return;
if (!string.IsNullOrEmpty(module))
module = "[" + module + "] ";
if (useDefaultColor)
Console.ResetColor();
else
Console.ForegroundColor = color;
text = module + text;
if (text.Length < Padding)
text = text.PadRight(Padding);
if (color == ConsoleColor.Red || color == ConsoleColor.DarkRed)
Console.Error.WriteLine(text);
else
Console.WriteLine(text);
Console.ResetColor();
Trace.WriteLine(obj);
}
}