summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs
blob: 117ae15c6b20af53182e1b2b1169fd0f39e861d2 (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
// Copyright 2022 Jamie Taylor
using System;
namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest {
    /// <summary>Metadata about a mod download in an update manifest file.</summary>
    internal class UpdateManifestModDownload : GenericModDownload {
        /// <summary>The subkey for this mod download</summary>
        private readonly string subkey;
        /// <summary>Construct an instance.</summary>
        /// <param name="subkey">The subkey for this download.</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 subkey, string name, string? version, string? url) : base(name, null, version, url) {
            this.subkey = subkey;
        }

        /// <summary>
        ///   Returns <see langword="true"/> iff the given subkey is the same as the subkey for this download.
        /// </summary>
        /// <param name="subkey">The subkey to match</param>
        /// <returns><see langword="true"/> if <paramref name="subkey"/> is the same as the subkey for this download, <see langword="false"/> otherwise.</returns>
        public override bool MatchesSubkey(string subkey) {
            return this.subkey == subkey;
        }
    }
}