diff options
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/IModMetadata.cs | 18 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModData/ParsedModDataRecord.cs | 7 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModMetadata.cs | 25 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs | 37 |
4 files changed, 18 insertions, 69 deletions
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs index b71c8056..d3ec0035 100644 --- a/src/SMAPI/Framework/IModMetadata.cs +++ b/src/SMAPI/Framework/IModMetadata.cs @@ -1,6 +1,6 @@ using StardewModdingAPI.Framework.ModData; using StardewModdingAPI.Framework.ModLoading; -using StardewModdingAPI.Framework.ModUpdateChecking; +using StardewModdingAPI.Toolkit.Framework.Clients.WebApi; namespace StardewModdingAPI.Framework { @@ -46,11 +46,9 @@ namespace StardewModdingAPI.Framework /// <summary>Whether the mod is a content pack.</summary> bool IsContentPack { get; } - /// <summary>The update status of this mod (if any).</summary> - ModUpdateStatus UpdateStatus { get; } + /// <summary>The update-check metadata for this mod (if any).</summary> + ModEntryModel UpdateCheckData { get; } - /// <summary>The preview update status of this mod (if any).</summary> - ModUpdateStatus PreviewUpdateStatus { get; } /********* ** Public methods @@ -78,13 +76,9 @@ namespace StardewModdingAPI.Framework /// <param name="api">The mod-provided API.</param> IModMetadata SetApi(object api); - /// <summary>Set the update status.</summary> - /// <param name="updateStatus">The mod update status.</param> - IModMetadata SetUpdateStatus(ModUpdateStatus updateStatus); - - /// <summary>Set the preview update status.</summary> - /// <param name="previewUpdateStatus">The mod preview update status.</param> - IModMetadata SetPreviewUpdateStatus(ModUpdateStatus previewUpdateStatus); + /// <summary>Set the update-check metadata for this mod.</summary> + /// <param name="data">The update-check metadata.</param> + IModMetadata SetUpdateData(ModEntryModel data); /// <summary>Whether the mod manifest was loaded (regardless of whether the mod itself was loaded).</summary> bool HasManifest(); diff --git a/src/SMAPI/Framework/ModData/ParsedModDataRecord.cs b/src/SMAPI/Framework/ModData/ParsedModDataRecord.cs index deb12bdc..3801fac3 100644 --- a/src/SMAPI/Framework/ModData/ParsedModDataRecord.cs +++ b/src/SMAPI/Framework/ModData/ParsedModDataRecord.cs @@ -40,9 +40,12 @@ namespace StardewModdingAPI.Framework.ModData /// <summary>Get a semantic remote version for update checks.</summary> /// <param name="version">The remote version to normalise.</param> - public string GetRemoteVersionForUpdateChecks(string version) + public ISemanticVersion GetRemoteVersionForUpdateChecks(string version) { - return this.DataRecord.GetRemoteVersionForUpdateChecks(version); + string rawVersion = this.DataRecord.GetRemoteVersionForUpdateChecks(version); + return rawVersion != null + ? new SemanticVersion(rawVersion) + : null; } } } diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index 88d2770c..02a77778 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using StardewModdingAPI.Framework.ModData; -using StardewModdingAPI.Framework.ModUpdateChecking; +using StardewModdingAPI.Toolkit.Framework.Clients.WebApi; namespace StardewModdingAPI.Framework.ModLoading { @@ -44,11 +44,8 @@ namespace StardewModdingAPI.Framework.ModLoading /// <summary>The mod-provided API (if any).</summary> public object Api { get; private set; } - /// <summary>The update status of this mod (if any).</summary> - public ModUpdateStatus UpdateStatus { get; private set; } - - /// <summary>The preview update status of this mod (if any).</summary> - public ModUpdateStatus PreviewUpdateStatus { get; private set; } + /// <summary>The update-check metadata for this mod (if any).</summary> + public ModEntryModel UpdateCheckData { get; private set; } /// <summary>Whether the mod is a content pack.</summary> public bool IsContentPack => this.Manifest?.ContentPackFor != null; @@ -122,19 +119,11 @@ namespace StardewModdingAPI.Framework.ModLoading return this; } - /// <summary>Set the update status.</summary> - /// <param name="updateStatus">The mod update status.</param> - public IModMetadata SetUpdateStatus(ModUpdateStatus updateStatus) - { - this.UpdateStatus = updateStatus; - return this; - } - - /// <summary>Set the preview update status.</summary> - /// <param name="previewUpdateStatus">The mod preview update status.</param> - public IModMetadata SetPreviewUpdateStatus(ModUpdateStatus previewUpdateStatus) + /// <summary>Set the update-check metadata for this mod.</summary> + /// <param name="data">The update-check metadata.</param> + public IModMetadata SetUpdateData(ModEntryModel data) { - this.PreviewUpdateStatus = previewUpdateStatus; + this.UpdateCheckData = data; return this; } diff --git a/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs b/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs deleted file mode 100644 index efb32aef..00000000 --- a/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace StardewModdingAPI.Framework.ModUpdateChecking -{ - /// <summary>Update status for a mod.</summary> - internal class ModUpdateStatus - { - /********* - ** Accessors - *********/ - /// <summary>The version that this mod can be updated to (if any).</summary> - public ISemanticVersion Version { get; } - - /// <summary>The error checking for updates of this mod (if any).</summary> - public string Error { get; } - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="version">The version that this mod can be update to.</param> - public ModUpdateStatus(ISemanticVersion version) - { - this.Version = version; - } - - /// <summary>Construct an instance.</summary> - /// <param name="error">The error checking for updates of this mod.</param> - public ModUpdateStatus(string error) - { - this.Error = error; - } - - /// <summary>Construct an instance.</summary> - public ModUpdateStatus() - { - } - } -} |