using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace StardewModdingAPI.Framework.Models
{
/// Contains abstract metadata about an incompatible mod.
internal class IncompatibleMod
{
/*********
** Accessors
*********/
/****
** From config
****/
/// The unique mod ID.
public string ID { get; set; }
/// The mod name.
public string Name { get; set; }
/// The oldest incompatible mod version, or null for all past versions.
public string LowerVersion { get; set; }
/// The most recent incompatible mod version.
public string UpperVersion { get; set; }
/// The URL the user can check for an official updated version.
public string UpdateUrl { get; set; }
/// The URL the user can check for an unofficial updated version.
public string UnofficialUpdateUrl { get; set; }
/// A regular expression matching version strings to consider compatible, even if they technically precede .
public string ForceCompatibleVersion { get; set; }
/// The reason phrase to show in the warning, or null to use the default value.
/// "this version is incompatible with the latest version of the game"
public string ReasonPhrase { get; set; }
/****
** Injected
****/
/// The semantic version corresponding to .
[JsonIgnore]
public ISemanticVersion LowerSemanticVersion { get; set; }
/// The semantic version corresponding to .
[JsonIgnore]
public ISemanticVersion UpperSemanticVersion { get; set; }
/*********
** Private methods
*********/
/// The method called when the model finishes deserialising.
/// The deserialisation context.
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
this.LowerSemanticVersion = this.LowerVersion != null ? new SemanticVersion(this.LowerVersion) : null;
this.UpperSemanticVersion = this.UpperVersion != null ? new SemanticVersion(this.UpperVersion) : null;
}
}
}