diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2023-01-29 16:37:22 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2023-01-29 16:37:22 -0500 |
commit | 25c2081d43bd4026552cda687fb56216dd3a9f8e (patch) | |
tree | 2cddef2bd5db31a5977d47b5450bfb80e813a8f0 /src/SMAPI.Web/Framework/Clients/UpdateManifest | |
parent | 55fd4839da43e7ca205eaa85480786e3dfe8af6f (diff) | |
download | SMAPI-25c2081d43bd4026552cda687fb56216dd3a9f8e.tar.gz SMAPI-25c2081d43bd4026552cda687fb56216dd3a9f8e.tar.bz2 SMAPI-25c2081d43bd4026552cda687fb56216dd3a9f8e.zip |
encapsulate update manifest implementation details when possible
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/UpdateManifest')
-rw-r--r-- | src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs | 2 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs index 0a6d4736..0128fa17 100644 --- a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs @@ -22,7 +22,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest public UpdateManifestModDownload(string fieldName, string name, string? version, string? url) : base(name, null, version, url) { - this.Subkey = fieldName; + this.Subkey = '@' + fieldName; } /// <summary>Get whether the subkey matches this download.</summary> diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs index bbc7b5da..befad268 100644 --- a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs @@ -34,7 +34,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest /// <returns>The mod name for the given subkey, or <see langword="null"/> if this manifest does not contain the given subkey.</returns> public override string? GetName(string? subkey) { - return subkey is not null && this.Mods.TryGetValue(subkey, out UpdateManifestModModel? modModel) + return subkey is not null && this.Mods.TryGetValue(subkey.TrimStart('@'), out UpdateManifestModModel? modModel) ? modModel.Name : null; } @@ -44,7 +44,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest /// <returns>The mod URL for the given subkey, or <see langword="null"/> if this manifest does not contain the given subkey.</returns> public override string? GetUrl(string? subkey) { - return subkey is not null && this.Mods.TryGetValue(subkey, out UpdateManifestModModel? modModel) + return subkey is not null && this.Mods.TryGetValue(subkey.TrimStart('@'), out UpdateManifestModModel? modModel) ? modModel.Url : null; } |