cleanup code, added version to commandline interface, updated MSTest nuget packages.

This commit is contained in:
2018-05-18 10:38:59 +02:00
parent cf4cc2cd93
commit 17e12093f8
10 changed files with 79 additions and 37 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Threading;
namespace KattekerCreator.Helper
{
@ -9,17 +10,17 @@ namespace KattekerCreator.Helper
public static void WriteInfoLine(string text)
{
using (var c = new ConsoleWithOtherColor())
using (new ConsoleWithOtherColor())
{
c.WriteLine($"{Info} [{DateTime.Now:G}] {text}");
ConsoleWithOtherColor.WriteLine($"{Info} [{DateTime.Now:G}] {text}");
}
}
public static void WriteErrorLine(string text)
{
using (var c = new ConsoleWithOtherColor(ConsoleColor.DarkRed))
using (new ConsoleWithOtherColor(ConsoleColor.DarkRed))
{
c.WriteLine($"{Error} [{DateTime.Now:G}] {text}");
ConsoleWithOtherColor.WriteLine($"{Error} [{DateTime.Now:G}] {text}");
}
}
}
@ -38,13 +39,20 @@ namespace KattekerCreator.Helper
Console.ForegroundColor = color;
}
public void WriteLine(string text)
public static void WriteLine(string text)
{
Console.WriteLine(text);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!disposing) return;
if (_defaultColor != null) Console.ForegroundColor = _defaultColor.Value;
}
}