From 5b9e365b5d252e2d1e957303c6b06fa1b3ae2f14 Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Sun, 10 Jun 2018 13:15:53 -0700 Subject: add version info to ModMetadata, change update checking to consider preview versions --- src/SMAPI/Framework/ModLoading/ModMetadata.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/SMAPI/Framework/ModLoading') diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index e4ec7e3b..8f544da3 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -43,6 +43,15 @@ namespace StardewModdingAPI.Framework.ModLoading /// The mod-provided API (if any). public object Api { get; private set; } + /// The latest version of the mod. + public ISemanticVersion LatestVersion { get; private set; } + + /// The latest preview version of the mod, if any. + public ISemanticVersion LatestPreviewVersion { get; private set; } + + /// The error checking for updates for this mod, if any. + public string UpdateCheckError { get; private set; } + /// Whether the mod is a content pack. public bool IsContentPack => this.Manifest?.ContentPackFor != null; @@ -115,6 +124,24 @@ namespace StardewModdingAPI.Framework.ModLoading return this; } + /// Set the update status. + /// The latest version. + /// The latest preview version. + public IModMetadata SetUpdateStatus(ISemanticVersion latestVersion, ISemanticVersion latestPreviewVersion) + { + this.LatestVersion = latestVersion; + this.LatestPreviewVersion = latestPreviewVersion; + return this; + } + + // Set the update status, indicating an error happened. + /// The error checking for updates, if any. + public IModMetadata SetUpdateStatus(string updateCheckError) + { + this.UpdateCheckError = updateCheckError; + return this; + } + /// Whether the mod manifest was loaded (regardless of whether the mod itself was loaded). public bool HasManifest() { -- cgit