From 3ccb5df3462b43a8faccd178aa2dd8ef9a7d93d6 Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:23:02 -0400 Subject: [PATCH] Fix Beat Saber version parsing --- IPA.Loader/Utilities/AlmostVersion.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IPA.Loader/Utilities/AlmostVersion.cs b/IPA.Loader/Utilities/AlmostVersion.cs index a9527503..494090e9 100644 --- a/IPA.Loader/Utilities/AlmostVersion.cs +++ b/IPA.Loader/Utilities/AlmostVersion.cs @@ -10,7 +10,7 @@ using Version = Hive.Versioning.Version; namespace IPA.Utilities { /// - /// A type that wraps so that the string of the version is stored when the string is + /// A type that wraps so that the string of the version is stored when the string is /// not a valid . /// public class AlmostVersion : IComparable, IComparable, @@ -61,7 +61,7 @@ namespace IPA.Utilities public AlmostVersion(SVersion ver) : this(ver?.UnderlyingVersion ?? throw new ArgumentNullException(nameof(ver))) { } /// - /// Creates an from the version string in stored using + /// Creates an from the version string in stored using /// the storage mode specified in . /// /// the text to parse as an @@ -92,7 +92,13 @@ namespace IPA.Utilities if (mode == StoredAs.SemVer) { StorageMode = StoredAs.SemVer; +#if BeatSaber + var index = str.IndexOf('_'); + var versionString = index >= 0 ? str.Substring(0, index) : str; + var result = Version.TryParse(versionString, out var version); +#else var result = Version.TryParse(str, out var version); +#endif SemverValue = version; return result; }