From ba07021fe6c892a630e0284cdc2bbe9281c020be Mon Sep 17 00:00:00 2001 From: Christian Engelhardt Date: Sun, 9 Feb 2025 22:36:59 +0100 Subject: [PATCH] fix: TotalPlayTime not converted directly to UInt32 --- CHANGELOG.md | 3 ++- libNOM.io/Extensions/Regex.cs | 2 +- libNOM.io/Meta/TotalPlayTime.cs | 2 +- libNOM.io/libNOM.io.csproj | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c080caf6..d84456fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. It uses the [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) principles and [Semantic Versioning](https://semver.org/) since 1.0.0. -## Unreleased +## Unreleased (0.14.1) ### Known Issues ### Added @@ -12,6 +12,7 @@ since 1.0.0. ### Deprecated ### Removed ### Fixed +* Potential exception when having a really high play time ### Security ## 0.14.0 (2025-02-09) diff --git a/libNOM.io/Extensions/Regex.cs b/libNOM.io/Extensions/Regex.cs index 2f5b2546..dd08be4e 100644 --- a/libNOM.io/Extensions/Regex.cs +++ b/libNOM.io/Extensions/Regex.cs @@ -12,7 +12,7 @@ internal static partial class MatchExtensions /// /// /// - internal static int ToInt32Value(this Match self) => System.Convert.ToInt32(self.Groups[1].Value); + internal static uint ToUInt32Value(this Match self) => System.Convert.ToUInt32(self.Groups[1].Value); /// /// Gets the captured substring from the input string. diff --git a/libNOM.io/Meta/TotalPlayTime.cs b/libNOM.io/Meta/TotalPlayTime.cs index 37629861..f5eccaa6 100644 --- a/libNOM.io/Meta/TotalPlayTime.cs +++ b/libNOM.io/Meta/TotalPlayTime.cs @@ -36,7 +36,7 @@ internal static partial class TotalPlayTime /// /// /// - public static uint Get(string? json) => (uint)(RegexesTotalPlayTime.Match(json)?.ToInt32Value() ?? 0); + public static uint Get(string? json) => RegexesTotalPlayTime.Match(json)?.ToUInt32Value() ?? 0; #endregion } diff --git a/libNOM.io/libNOM.io.csproj b/libNOM.io/libNOM.io.csproj index 847668ce..f669335a 100644 --- a/libNOM.io/libNOM.io.csproj +++ b/libNOM.io/libNOM.io.csproj @@ -52,7 +52,7 @@ - 0.14.0 + 0.14.1-beta.1 cengelha Provides reading and writing save files from the game No Man's Sky for all possible platforms as well as related actions. Copyright (c) Christian Engelhardt 2021