diff --git a/src/Misc/Curiosity.Tools/CHANGELOG.md b/src/Misc/Curiosity.Tools/CHANGELOG.md index 3796e45..03035fb 100644 --- a/src/Misc/Curiosity.Tools/CHANGELOG.md +++ b/src/Misc/Curiosity.Tools/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.5.3] + +### Changed + +- `PublicId.ToPublicId()` returns 16 chars string again + ## [1.5.2] ### Changed diff --git a/src/Misc/Curiosity.Tools/Curiosity.Tools.csproj b/src/Misc/Curiosity.Tools/Curiosity.Tools.csproj index a423458..35b85eb 100644 --- a/src/Misc/Curiosity.Tools/Curiosity.Tools.csproj +++ b/src/Misc/Curiosity.Tools/Curiosity.Tools.csproj @@ -12,7 +12,7 @@ 1.0.0 1.0.0 - 1.5.2 + 1.5.3 Max Markelow (@markeli), Andrey Ioch (@DevCorvette) SIIS Ltd diff --git a/src/Misc/Curiosity.Tools/UniqueId/PublicId.cs b/src/Misc/Curiosity.Tools/UniqueId/PublicId.cs index f2d89ea..144f78f 100644 --- a/src/Misc/Curiosity.Tools/UniqueId/PublicId.cs +++ b/src/Misc/Curiosity.Tools/UniqueId/PublicId.cs @@ -15,11 +15,9 @@ public static class PublicId /// ID in HEX public static string ToPublicId(this long id) { - // number 17 in the format indicates the minimum number of characters in the string + // number 16 in the format indicates the minimum number of characters in the string // missing characters are replaced with 0 - // by the first 0, we can detect that the number is hexadecimal, even if all numbers are there - // until 2024 year, our UniqueIdGenerator had generated 16 characters string - return id.ToString("x17", CultureInfo.InvariantCulture); + return id.ToString("x16", CultureInfo.InvariantCulture); } /// @@ -52,9 +50,8 @@ private static bool IsHexFormat(string line) return true; } - // until 2024 year, our UniqueIdGenerator had generated 16 chars string then 17 chars - // always with first 0 - if ((line.Length == 16 || line.Length == 17) && + // our UniqueIdGenerator will generate hex id with first 0 until 2028 year + if ((line.Length == 16) && line[0] == '0') return true; diff --git a/tests/UnitTests/Misc/Curiosity.Tools.UnitTests/UniqueId/PublicIdTests.cs b/tests/UnitTests/Misc/Curiosity.Tools.UnitTests/UniqueId/PublicIdTests.cs index e30b063..697fe58 100644 --- a/tests/UnitTests/Misc/Curiosity.Tools.UnitTests/UniqueId/PublicIdTests.cs +++ b/tests/UnitTests/Misc/Curiosity.Tools.UnitTests/UniqueId/PublicIdTests.cs @@ -21,22 +21,6 @@ public void TryParse_Parse16CharsHexLine_LongValue() id.Should().Be(value); } - // can detect that line is 17 chars hex and parse it to true long value - [Fact] - public void TryParse_Parse17CharsHexLine_LongValue() - { - // arrange - const long value = 10752219502637056; - const string hex = "00026331630007000"; // 17 chars hex - - // act - var canParse = PublicId.TryParse(hex, out var id); - - // assert - canParse.Should().Be(true); - id.Should().Be(value); - } - // can detect that line is dec and parse it to true long value [Fact] public void TryParse_ParseDecLine_LongValue()