diff options
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/IModMetadata.cs | 17 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModMetadata.cs | 27 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs index c0d6408d..673c5b2e 100644 --- a/src/SMAPI/Framework/IModMetadata.cs +++ b/src/SMAPI/Framework/IModMetadata.cs @@ -45,6 +45,14 @@ namespace StardewModdingAPI.Framework /// <summary>Whether the mod is a content pack.</summary> bool IsContentPack { get; } + /// <summary>The latest version of the mod.</summary> + ISemanticVersion LatestVersion { get; } + + /// <summary>The latest preview version of the mod, if any.</summary> + ISemanticVersion LatestPreviewVersion { get; } + + /// <summary>The error checking for updates for this mod, if any.</summary> + string UpdateCheckError { get; } /********* ** Public methods @@ -72,6 +80,15 @@ namespace StardewModdingAPI.Framework /// <param name="api">The mod-provided API.</param> IModMetadata SetApi(object api); + /// <summary>Set the update status, indicating no errors happened.</summary> + /// <param name="latestVersion">The latest version.</param> + /// <param name="latestPreviewVersion">The latest preview version.</param> + IModMetadata SetUpdateStatus(ISemanticVersion latestVersion, ISemanticVersion latestPreviewVersion); + + /// <summary>Set the update status, indicating an error happened.</summary> + /// <param name="updateCheckError">The error checking for updates, if any.</param> + IModMetadata SetUpdateStatus(string updateCheckError); + /// <summary>Whether the mod manifest was loaded (regardless of whether the mod itself was loaded).</summary> bool HasManifest(); 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 /// <summary>The mod-provided API (if any).</summary> public object Api { get; private set; } + /// <summary>The latest version of the mod.</summary> + public ISemanticVersion LatestVersion { get; private set; } + + /// <summary>The latest preview version of the mod, if any.</summary> + public ISemanticVersion LatestPreviewVersion { get; private set; } + + /// <summary>The error checking for updates for this mod, if any.</summary> + public string UpdateCheckError { get; private set; } + /// <summary>Whether the mod is a content pack.</summary> public bool IsContentPack => this.Manifest?.ContentPackFor != null; @@ -115,6 +124,24 @@ namespace StardewModdingAPI.Framework.ModLoading return this; } + /// <summary>Set the update status.</summary> + /// <param name="latestVersion">The latest version.</param> + /// <param name="latestPreviewVersion">The latest preview version.</param> + public IModMetadata SetUpdateStatus(ISemanticVersion latestVersion, ISemanticVersion latestPreviewVersion) + { + this.LatestVersion = latestVersion; + this.LatestPreviewVersion = latestPreviewVersion; + return this; + } + + // <summary>Set the update status, indicating an error happened.</summary> + /// <param name="updateCheckError">The error checking for updates, if any.</param> + public IModMetadata SetUpdateStatus(string updateCheckError) + { + this.UpdateCheckError = updateCheckError; + return this; + } + /// <summary>Whether the mod manifest was loaded (regardless of whether the mod itself was loaded).</summary> public bool HasManifest() { |