use new namespace style

This commit is contained in:
Chomp 2021-11-23 13:01:42 +00:00
parent 5f9c13232b
commit f7bbc5adee
4 changed files with 37 additions and 45 deletions

View File

@ -1,10 +1,10 @@
using System.Linq;
namespace Common
namespace Common;
public static class BulletHelpers
{
public static class BulletHelpers
{
private static readonly string[] blackList = {
private static readonly string[] blackList = {
"56dff3afd2720bba668b4567", // 5.45x39 ps
"5c0d56a986f774449d5de529", // 9x19mm rip
"58864a4f2459770fcc257101", // 9x19mm pso
@ -30,9 +30,8 @@ namespace Common
"5e023e88277cce2b522ff2b1" // 7.62x51 ultra nosler
};
public static bool BulletIsOnBlackList(string bullet)
{
return blackList.Any(x => x.Contains(bullet));
}
public static bool BulletIsOnBlackList(string bullet)
{
return blackList.Any(x => x.Contains(bullet));
}
}

View File

@ -1,16 +1,14 @@
using System.IO;
namespace Common
namespace Common;
public static class DiskHelpers
{
public static class DiskHelpers
public static void CreateDirIfDoesntExist(string path)
{
public static void CreateDirIfDoesntExist(string path)
if (!Directory.Exists($"{path}"))
{
if (!Directory.Exists($"{path}"))
{
//create dump dir
Directory.CreateDirectory($"{path}");
}
//create dump dir
Directory.CreateDirectory($"{path}");
}
}
}

View File

@ -1,11 +1,10 @@
using Common.Models;
using System.Collections.Generic;
namespace Common.Extensions
namespace Common.Extensions;
public static class EnumExtensions
{
public static class EnumExtensions
{
private static readonly List<BotType> bossTypes = new List<BotType>(){
private static readonly List<BotType> bossTypes = new List<BotType>(){
BotType.bossbully,
BotType.bossgluhar,
BotType.bosskilla,
@ -14,9 +13,8 @@ namespace Common.Extensions
BotType.bosstagilla
};
public static bool IsBoss(this BotType self)
{
return bossTypes.Contains(self);
}
public static bool IsBoss(this BotType self)
{
return bossTypes.Contains(self);
}
}

View File

@ -1,28 +1,25 @@
using System;
namespace Common;
namespace Common
public static class LoggingHelpers
{
public static class LoggingHelpers
public static string LogTimeTaken(double totalSeconds)
{
public static string LogTimeTaken(double totalSeconds)
{
return Math.Round(totalSeconds, 2, MidpointRounding.ToEven).ToString();
}
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;
public static void LogToConsole(string message, ConsoleColor backgroundColour = ConsoleColor.Green)
{
Console.BackgroundColor = backgroundColour;
Console.ForegroundColor = ConsoleColor.Black;
Console.Write(message);
ResetConsoleColours();
Console.WriteLine();
}
Console.Write(message);
ResetConsoleColours();
Console.WriteLine();
}
private static void ResetConsoleColours()
{
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White;
}
private static void ResetConsoleColours()
{
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White;
}
}