using System; namespace StardewModdingAPI.Web.Framework.Clients { /// Generic metadata about a file download on a mod page. internal class GenericModDownload : IModDownload { /********* ** Accessors *********/ /// The download's display name. public string Name { get; } /// The download's description. public string? Description { get; } /// The download's file version. public string? Version { get; } /// The mod URL page from which to download this update, if different from the URL of the mod page it was fetched from. public string? ModPageUrl { get; } /********* ** Public methods *********/ /// Construct an instance. /// The download's display name. /// The download's description. /// The download's file version. /// The mod URL page from which to download this update, if different from the URL of the mod page it was fetched from. public GenericModDownload(string name, string? description, string? version, string? modPageUrl = null) { this.Name = name; this.Description = description; this.Version = version; this.ModPageUrl = modPageUrl; } /// Get whether the subkey matches this download. /// The update subkey to check. public virtual bool MatchesSubkey(string subkey) { return this.Name.Contains(subkey, StringComparison.OrdinalIgnoreCase) || this.Description?.Contains(subkey, StringComparison.OrdinalIgnoreCase) == true; } } }