mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Remove dependency on Humanizer
This commit is contained in:
@@ -79,10 +79,6 @@
|
||||
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Humanizer, Version=2.1.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Humanizer.Core.2.1.0\lib\netstandard1.0\Humanizer.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.2-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Humanizer;
|
||||
using System.Text;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Utilities {
|
||||
@@ -73,6 +73,52 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
internal static string ToHumanReadable(this TimeSpan timeSpan) => timeSpan.Humanize(3, true);
|
||||
internal static string ToHumanReadable(this TimeSpan timeSpan) {
|
||||
// It's really dirty, I'd appreciate a lot if C# offered nice TimeSpan formatting by default
|
||||
// Normally I'd use third-party library like Humanizer, but using it only for this bit is not worth it
|
||||
// Besides, ILRepack has problem merging it's library due to referencing System.Runtime
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (timeSpan.Days > 0) {
|
||||
result.Append(" " + timeSpan.Days + " day");
|
||||
|
||||
if (timeSpan.Days > 1) {
|
||||
result.Append('s');
|
||||
}
|
||||
|
||||
result.Append(',');
|
||||
}
|
||||
|
||||
if (timeSpan.Hours > 0) {
|
||||
result.Append(" " + timeSpan.Hours + " hour");
|
||||
if (timeSpan.Hours > 1) {
|
||||
result.Append('s');
|
||||
}
|
||||
|
||||
result.Append(',');
|
||||
}
|
||||
|
||||
if (timeSpan.Seconds > 0) {
|
||||
result.Append(" " + timeSpan.Hours + " second");
|
||||
if (timeSpan.Seconds > 1) {
|
||||
result.Append('s');
|
||||
}
|
||||
|
||||
result.Append(',');
|
||||
}
|
||||
|
||||
if (result.Length <= 1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Get rid of initial space
|
||||
result.Remove(0, 1);
|
||||
|
||||
// Get rid of last comma
|
||||
result.Length--;
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
<package id="Costura.Fody" version="2.0.0-beta0018" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Fody" version="1.30.0-beta01" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net461" />
|
||||
<package id="Humanizer.Core" version="2.1.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="9.0.2-beta1" targetFramework="net461" />
|
||||
<package id="NLog" version="5.0.0-beta04" targetFramework="net461" />
|
||||
<package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
|
||||
|
||||
@@ -48,10 +48,6 @@
|
||||
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Humanizer, Version=2.1.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Humanizer.Core.2.1.0\lib\netstandard1.0\Humanizer.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.2-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<package id="Costura.Fody" version="2.0.0-beta0018" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Fody" version="1.30.0-beta01" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net461" />
|
||||
<package id="Humanizer.Core" version="2.1.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="9.0.2-beta1" targetFramework="net461" />
|
||||
<package id="NLog" version="5.0.0-beta04" targetFramework="net461" />
|
||||
<package id="NLog.Windows.Forms" version="4.2.3" targetFramework="net461" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user