|
@ -10,7 +10,7 @@ using Version = Hive.Versioning.Version; |
|
|
namespace IPA.Utilities |
|
|
namespace IPA.Utilities |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// A type that wraps <see cref="Version"/> so that the string of the version is stored when the string is
|
|
|
|
|
|
|
|
|
/// A type that wraps <see cref="Version"/> so that the string of the version is stored when the string is
|
|
|
/// not a valid <see cref="Version"/>.
|
|
|
/// not a valid <see cref="Version"/>.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public class AlmostVersion : IComparable<AlmostVersion>, IComparable<Version>, |
|
|
public class AlmostVersion : IComparable<AlmostVersion>, IComparable<Version>, |
|
@ -61,7 +61,7 @@ namespace IPA.Utilities |
|
|
public AlmostVersion(SVersion ver) : this(ver?.UnderlyingVersion ?? throw new ArgumentNullException(nameof(ver))) { } |
|
|
public AlmostVersion(SVersion ver) : this(ver?.UnderlyingVersion ?? throw new ArgumentNullException(nameof(ver))) { } |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Creates an <see cref="AlmostVersion"/> from the version string in <paramref name="vertext"/> stored using
|
|
|
|
|
|
|
|
|
/// Creates an <see cref="AlmostVersion"/> from the version string in <paramref name="vertext"/> stored using
|
|
|
/// the storage mode specified in <paramref name="mode"/>.
|
|
|
/// the storage mode specified in <paramref name="mode"/>.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="vertext">the text to parse as an <see cref="AlmostVersion"/></param>
|
|
|
/// <param name="vertext">the text to parse as an <see cref="AlmostVersion"/></param>
|
|
@ -92,7 +92,13 @@ namespace IPA.Utilities |
|
|
if (mode == StoredAs.SemVer) |
|
|
if (mode == StoredAs.SemVer) |
|
|
{ |
|
|
{ |
|
|
StorageMode = 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); |
|
|
var result = Version.TryParse(str, out var version); |
|
|
|
|
|
#endif
|
|
|
SemverValue = version; |
|
|
SemverValue = version; |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|