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; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The download's display name.
/// The download's description.
/// The download's file version.
public GenericModDownload(string name, string? description, string? version)
{
this.Name = name;
this.Description = description;
this.Version = version;
}
///
/// Return true if the subkey matches this download. A subkey matches if it appears as
/// a substring in the name or description.
///
/// the subkey
/// true if matches this download, otherwise false
///
public bool MatchesSubkey(string subkey) {
return this.Name.Contains(subkey, StringComparison.OrdinalIgnoreCase) == true
|| this.Description?.Contains(subkey, StringComparison.OrdinalIgnoreCase) == true;
}
}
}