using System.Runtime.Serialization; using Newtonsoft.Json; namespace StardewModdingAPI.Framework.Models { /// Metadata about a mod version that SMAPI should assume is compatible or broken, regardless of whether it detects incompatible code. internal class ModCompatibility { /********* ** Accessors *********/ /**** ** From config ****/ /// The unique mod IDs. 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; } /// A label to show to the user instead of , when the manifest version differs from the user-facing version. public string UpperVersionLabel { 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; } /// 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; } /// Indicates how SMAPI should consider the mod. public ModCompatibilityType Compatibility { 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; } } }