namespace StardewModdingAPI.Toolkit.Framework.ModData
{
/// The versioned fields from a for a specific manifest.
public class ModDataRecordVersionedFields
{
/*********
** Accessors
*********/
/// The underlying data record.
public ModDataRecord DataRecord { get; set; }
/// The default mod name to display when the name isn't available (e.g. during dependency checks).
public string DisplayName { get; set; }
/// The update key to apply.
public string UpdateKey { get; set; }
/// The alternative URL the player can check for an updated version.
public string AlternativeUrl { get; set; }
/// The predefined compatibility status.
public ModStatus Status { get; set; } = ModStatus.None;
/// A reason phrase for the , or null to use the default reason.
public string StatusReasonPhrase { get; set; }
/// The upper version for which the applies (if any).
public ISemanticVersion StatusUpperVersion { get; set; }
/*********
** Public methods
*********/
/// Get a semantic local version for update checks.
/// The remote version to normalise.
public ISemanticVersion GetLocalVersionForUpdateChecks(ISemanticVersion version)
{
return this.DataRecord.GetLocalVersionForUpdateChecks(version);
}
/// Get a semantic remote version for update checks.
/// The remote version to normalise.
public ISemanticVersion GetRemoteVersionForUpdateChecks(ISemanticVersion version)
{
if (version == null)
return null;
string rawVersion = this.DataRecord.GetRemoteVersionForUpdateChecks(version.ToString());
return rawVersion != null
? new SemanticVersion(rawVersion)
: version;
}
}
}