diff --git a/src/Ryujinx/Utilities/PlayReport/Analyzer.cs b/src/Ryujinx/Utilities/PlayReport/Analyzer.cs index 51047cc32..cd4021bc4 100644 --- a/src/Ryujinx/Utilities/PlayReport/Analyzer.cs +++ b/src/Ryujinx/Utilities/PlayReport/Analyzer.cs @@ -1,5 +1,6 @@ using Gommon; using Ryujinx.Ava.Utilities.AppLibrary; +using Ryujinx.Common.Logging; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -27,10 +28,12 @@ namespace Ryujinx.Ava.Utilities.PlayReport /// The current , for chaining convenience. public Analyzer AddSpec(string titleId, Func transform) { - Guard.Ensure(ulong.TryParse(titleId, NumberStyles.HexNumber, null, out _), - $"Cannot use a non-hexadecimal string as the Title ID for a {nameof(GameSpec)}."); + if (ulong.TryParse(titleId, NumberStyles.HexNumber, null, out _)) + return AddSpec(transform(GameSpec.Create(titleId))); - return AddSpec(transform(GameSpec.Create(titleId))); + Logger.Notice.PrintMsg(LogClass.Application, + $"Tried to add a {nameof(GameSpec)} with a non-hexadecimal title ID value. Input: '{titleId}'"); + return this; } /// @@ -41,10 +44,12 @@ namespace Ryujinx.Ava.Utilities.PlayReport /// The current , for chaining convenience. public Analyzer AddSpec(string titleId, Action transform) { - Guard.Ensure(ulong.TryParse(titleId, NumberStyles.HexNumber, null, out _), - $"Cannot use a non-hexadecimal string as the Title ID for a {nameof(GameSpec)}."); + if (ulong.TryParse(titleId, NumberStyles.HexNumber, null, out _)) + return AddSpec(GameSpec.Create(titleId).Apply(transform)); - return AddSpec(GameSpec.Create(titleId).Apply(transform)); + Logger.Notice.PrintMsg(LogClass.Application, + $"Tried to add a {nameof(GameSpec)} with a non-hexadecimal title ID value. Input: '{titleId}'"); + return this; } /// @@ -57,10 +62,19 @@ namespace Ryujinx.Ava.Utilities.PlayReport Func transform) { string[] tids = titleIds.ToArray(); - Guard.Ensure(tids.All(x => ulong.TryParse(x, NumberStyles.HexNumber, null, out _)), - $"Cannot use a non-hexadecimal string as the Title ID for a {nameof(GameSpec)}."); + if (tids.All(x => ulong.TryParse(x, NumberStyles.HexNumber, null, out _) && !string.IsNullOrEmpty(x))) + return AddSpec(transform(GameSpec.Create(tids))); - return AddSpec(transform(GameSpec.Create(tids))); + Logger.Notice.PrintMsg(LogClass.Application, + $"Tried to add a {nameof(GameSpec)} with a non-hexadecimal title ID value. Input: '{ + tids.FormatCollection( + x => x, + separator: ", ", + prefix: "[", + suffix: "]" + ) + }'"); + return this; } /// @@ -72,12 +86,21 @@ namespace Ryujinx.Ava.Utilities.PlayReport public Analyzer AddSpec(IEnumerable titleIds, Action transform) { string[] tids = titleIds.ToArray(); - Guard.Ensure(tids.All(x => ulong.TryParse(x, NumberStyles.HexNumber, null, out _)), - $"Cannot use a non-hexadecimal string as the Title ID for a {nameof(GameSpec)}."); + if (tids.All(x => ulong.TryParse(x, NumberStyles.HexNumber, null, out _) && !string.IsNullOrEmpty(x))) + return AddSpec(GameSpec.Create(tids).Apply(transform)); - return AddSpec(GameSpec.Create(tids).Apply(transform)); + Logger.Notice.PrintMsg(LogClass.Application, + $"Tried to add a {nameof(GameSpec)} with a non-hexadecimal title ID value. Input: '{ + tids.FormatCollection( + x => x, + separator: ", ", + prefix: "[", + suffix: "]" + ) + }'"); + return this; } - + /// /// Add an analysis spec matching a specific game by title ID, with the provided pre-configured spec. ///