summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs
blob: f8cb760a4b9c6d7c10207db854f95986ec9fb959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest
{
    /// <summary>Metadata about a mod download in an update manifest file.</summary>
    internal class UpdateManifestModDownload : GenericModDownload
    {
        /*********
        ** Fields
        *********/
        /// <summary>The update subkey for this mod download.</summary>
        private readonly string Subkey;


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="fieldName">The field name for this mod download in the manifest.</param>
        /// <param name="name">The mod name for this download.</param>
        /// <param name="version">The download's version.</param>
        /// <param name="url">The download's URL.</param>
        public UpdateManifestModDownload(string fieldName, string name, string? version, string? url)
            : base(name, null, version, url)
        {
            this.Subkey = '@' + fieldName;
        }

        /// <summary>Get whether the subkey matches this download.</summary>
        /// <param name="subkey">The update subkey to check.</param>
        public override bool MatchesSubkey(string subkey)
        {
            return subkey == this.Subkey;
        }
    }
}