Improved .shardstats format + small cleanup

This commit is contained in:
Kwoth
2021-06-20 06:15:30 +02:00
parent c86bf6f300
commit 77904a3b00
6 changed files with 50 additions and 30 deletions

View File

@@ -12,6 +12,13 @@ namespace NadekoBot.Extensions
{
public static class StringExtensions
{
public static string PadBoth(this string str, int length)
{
int spaces = length - str.Length;
int padLeft = spaces / 2 + str.Length;
return str.PadLeft(padLeft).PadRight(length);
}
public static T MapJson<T>(this string str)
=> JsonConvert.DeserializeObject<T>(str);