diff --git a/Bots.sln b/Bots.sln index ff8e5e7..c18ceb4 100644 --- a/Bots.sln +++ b/Bots.sln @@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31424.327 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator", "Generator\Generator.csproj", "{79CD3722-D6A7-4BA1-8CDF-533A77566D93}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator", "Generator\Generator.csproj", "{79CD3722-D6A7-4BA1-8CDF-533A77566D93}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PMCGenerator", "PMCGenerator\PMCGenerator.csproj", "{AA738C3F-2BA0-4754-A7A7-82E290BF51CA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{DE50047B-01AB-4B99-A270-95C8F6101D0D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +19,14 @@ Global {79CD3722-D6A7-4BA1-8CDF-533A77566D93}.Debug|Any CPU.Build.0 = Debug|Any CPU {79CD3722-D6A7-4BA1-8CDF-533A77566D93}.Release|Any CPU.ActiveCfg = Release|Any CPU {79CD3722-D6A7-4BA1-8CDF-533A77566D93}.Release|Any CPU.Build.0 = Release|Any CPU + {AA738C3F-2BA0-4754-A7A7-82E290BF51CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA738C3F-2BA0-4754-A7A7-82E290BF51CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA738C3F-2BA0-4754-A7A7-82E290BF51CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA738C3F-2BA0-4754-A7A7-82E290BF51CA}.Release|Any CPU.Build.0 = Release|Any CPU + {DE50047B-01AB-4B99-A270-95C8F6101D0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE50047B-01AB-4B99-A270-95C8F6101D0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE50047B-01AB-4B99-A270-95C8F6101D0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE50047B-01AB-4B99-A270-95C8F6101D0D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Common/Common.csproj b/Common/Common.csproj new file mode 100644 index 0000000..cb63190 --- /dev/null +++ b/Common/Common.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/Common/DiskHelpers.cs b/Common/DiskHelpers.cs new file mode 100644 index 0000000..a261a9d --- /dev/null +++ b/Common/DiskHelpers.cs @@ -0,0 +1,16 @@ +using System.IO; + +namespace Common +{ + public static class DiskHelpers + { + public static void CreateDirIfDoesntExist(string path) + { + if (!Directory.Exists($"{path}")) + { + //create dump dir + Directory.CreateDirectory($"{path}"); + } + } + } +} diff --git a/Common/Extensions/StringToolsExtensions.cs b/Common/Extensions/StringToolsExtensions.cs new file mode 100644 index 0000000..bbe6d9a --- /dev/null +++ b/Common/Extensions/StringToolsExtensions.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Common.Extensions +{ + public static class StringToolsExtensions + { + /// + /// Add a string to a list only if it doesnt already exist + /// + public static void AddUnique(this IList self, string item) + { + if (!self.Contains(item)) + self.Add(item); + } + } +} diff --git a/Common/LoggingHelpers.cs b/Common/LoggingHelpers.cs new file mode 100644 index 0000000..edf59e1 --- /dev/null +++ b/Common/LoggingHelpers.cs @@ -0,0 +1,28 @@ +using System; + +namespace Common +{ + public static class LoggingHelpers + { + public static string LogTimeTaken(double totalSeconds) + { + return Math.Round(totalSeconds, 2, MidpointRounding.ToEven).ToString(); + } + + public static void LogToConsole(string message, ConsoleColor backgroundColour = ConsoleColor.Green) + { + Console.BackgroundColor = backgroundColour; + Console.ForegroundColor = ConsoleColor.Black; + + Console.WriteLine(message); + + ResetConsoleColours(); + } + + private static void ResetConsoleColours() + { + Console.BackgroundColor = ConsoleColor.Black; + Console.ForegroundColor = ConsoleColor.White; + } + } +}