Date | 2022-02-14 (1,011 days ago) |
---|---|
Downloads | 8,778 downloads |
NuGet | View on NuGet |
GitHub | View on GitHub |
Target Frameworks | .NET Standard 1.1 .NET Standard 1.3 .NET Standard 2.0 .NET 4.5 .NET 4.6 .NET 4.7 .NET 4.8 |
#installation
">InstallationInstall the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials --version 1.1.36
or the NuGet package manager:
Install-Package Skybrud.Essentials -Version 1.1.36
#changelog
">ChangelogIntroduced new constants to the Iso8601Constants
class (see b6c2961
)
As part of introducing better support for milliseconds, this release introduces the Date
, DateTimeSeconds
and DateTimeMilliseconds
constants. The DateFormat
(replaced by Date
) and DateTimeFormat
(replaced by DateTimeSeconds
) are now marked as obsolete.
Introduced new logic for working with Unix time in milliseconds (see fe79cb5
)
New methods were added to the EssentialsTime
and UnixTimeUtils
classes for making working with Unix time more convenient. Changes include:
EssentialsTime.FromUnixTimestamp
methods as obsolete (as it was replaced by EssentialsTime.FromUnixTimeSeconds
)EssentialsTime.FromUnixTimeSeconds
methodsEssentialsTime.FromUnixTimeMilliseconds
methodsUnixTimeUtils.FromMilliseconds
methodsUnixTimeUtils.ToMilliseconds
methodsIntroduced new UnixTimeFormat
enum for UnixTimeConverter
class (see a6837d6
)
The JSON converter now supports specifying the format of the converter - either UnixTimeFormat.Seconds
(default) or UnixTimeFormat.Milliseconds
. Until now, the converter has only supported converting back and forth between the UNIX timestamp expressed with seconds, but by setting the format to UnixTimeFormat.Milliseconds
, the converter will now convert back and forth between milliseconds instead.
Improved the Unix time logic in the EssentialsTime
class (see 32860ca
)
New properties were added to the EssentialsTime
class for making working with Unix time more convenient. Changes include:
CurrentUnixTimeSeconds
static propertyCurrentUnixTimeMilliseconds
static propertyUnixTimestamp
property as obsolete (as it was replaced by UnixTimeSeconds
)UnixTimeSeconds
propertyUnixTimeMilliseconds
propertyToUnixTimeSeconds
methodtyToUnixTimeMilliseconds
methodEssentialsDate.TryParse
method should invariant culture if not a culture isn't explicitly specified (see 1733f2f
)
The general idea with Skybrud.Essentials is that various logic should be culture invariant - unless specified otherwise. The TryParse(string input, out EssentialsDate result)
relied on the current culture, which was wrong.
Added new method overloads to the ReflectionUtils
class (see 3753413
)
As typical usage to get the version of an assembly would be something like ReflectionUtils.GetVersion(typeof(MyType).Assembly)
, it's now possibly to use ReflectionUtils.GetVersion<MyType>()
instead.
Introduced new TryParseJsonToken
, TryParseJsonObject
and TryParseJsonArray
method to the JsonUtils
class (see dfef0f7
)
The new methods add a more safe way of parsing JSON values - eg. if the validity of the JSON is not certain. The implementation will catch an exception should it be triggered by JSON.net's parsing logic. It may still be best to do some simple validation on the input value first - eg. if it starts with [
or {
.
Introduced new StringUtils.ParseHexString
method (see 3fa44a3
)
The method allows parsing a HEX string into a corresponding byte array; the opposite of the StringUtils.ToHexString
method.