Initial commit

This commit is contained in:
Holger Boerchers
2018-03-21 20:07:40 +01:00
commit d383f0ef1c
77 changed files with 7050 additions and 0 deletions

51
Creator/Helper/Log.cs Normal file
View File

@ -0,0 +1,51 @@
using System;
namespace KattekerCreator.Helper
{
public static class Log
{
private const string Info = "INFO";
private const string Error = "ERROR";
public static void WriteInfoLine(string text)
{
using (var c = new ConsoleWithOtherColor())
{
c.WriteLine($"{Info} [{DateTime.Now:G}] {text}");
}
}
public static void WriteErrorLine(string text)
{
using (var c = new ConsoleWithOtherColor(ConsoleColor.DarkRed))
{
c.WriteLine($"{Error} [{DateTime.Now:G}] {text}");
}
}
}
public class ConsoleWithOtherColor : IDisposable
{
public ConsoleWithOtherColor()
{
}
private readonly ConsoleColor? _defaultColor;
public ConsoleWithOtherColor(ConsoleColor color)
{
_defaultColor = Console.ForegroundColor;
Console.ForegroundColor = color;
}
public void WriteLine(string text)
{
Console.WriteLine(text);
}
public void Dispose()
{
if (_defaultColor != null) Console.ForegroundColor = _defaultColor.Value;
}
}
}