add semanticVersion.IsPrerelease()
This commit is contained in:
parent
4cabd2b2e7
commit
6a6001c7e6
|
@ -12,6 +12,7 @@
|
|||
* Added code analysis to mod build config package to flag common issues as warnings.
|
||||
* Added `Context.IsMultiplayer` and `Context.IsMainPlayer` flags.
|
||||
* Added `Constants.TargetPlatform` which says whether the game is running on Linux, Mac, or Windows.
|
||||
* Added `semanticVersion.IsPrerelease()` method.
|
||||
* Fixed assets loaded by temporary content managers not being editable by mods.
|
||||
* Fixed assets not reloaded consistently when the player switches language.
|
||||
* Fixed console command input not saved to the log.
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace StardewModdingAPI.Framework.Models
|
|||
public bool CheckForUpdates { get; set; }
|
||||
|
||||
/// <summary>Whether to show beta versions as valid updates.</summary>
|
||||
public bool UseBetaChannel { get; set; } = Constants.ApiVersion.Build != null;
|
||||
public bool UseBetaChannel { get; set; } = Constants.ApiVersion.IsPrerelease();
|
||||
|
||||
/// <summary>SMAPI's GitHub project name, used to perform update checks.</summary>
|
||||
public string GitHubProjectName { get; set; }
|
||||
|
|
|
@ -24,6 +24,9 @@ namespace StardewModdingAPI
|
|||
/*********
|
||||
** Accessors
|
||||
*********/
|
||||
/// <summary>Whether this is a pre-release version.</summary>
|
||||
bool IsPrerelease();
|
||||
|
||||
/// <summary>Get whether this version is older than the specified version.</summary>
|
||||
/// <param name="other">The version to compare with this instance.</param>
|
||||
bool IsOlderThan(ISemanticVersion other);
|
||||
|
|
|
@ -670,7 +670,7 @@ namespace StardewModdingAPI
|
|||
return
|
||||
newVersion != null
|
||||
&& newVersion.IsNewerThan(currentVersion)
|
||||
&& (useBetaChannel || newVersion.Build == null);
|
||||
&& (useBetaChannel || !newVersion.IsPrerelease());
|
||||
}
|
||||
|
||||
/// <summary>Create a directory path if it doesn't exist.</summary>
|
||||
|
|
|
@ -55,6 +55,12 @@ namespace StardewModdingAPI
|
|||
public SemanticVersion(Version version)
|
||||
: this(new SemanticVersionImpl(version)) { }
|
||||
|
||||
/// <summary>Whether this is a pre-release version.</summary>
|
||||
public bool IsPrerelease()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(this.Build);
|
||||
}
|
||||
|
||||
/// <summary>Get an integer indicating whether this version precedes (less than 0), supercedes (more than 0), or is equivalent to (0) the specified version.</summary>
|
||||
/// <param name="other">The version to compare with this instance.</param>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="other"/> value is null.</exception>
|
||||
|
|
Loading…
Reference in New Issue