namespace StardewModdingAPI.Framework.Models { /// A mod dependency listed in a mod manifest. internal class ManifestDependency : IManifestDependency { /********* ** Accessors *********/ /// The unique mod ID to require. public string UniqueID { get; } /// The minimum required version (if any). public ISemanticVersion MinimumVersion { get; } /// Whether the dependency must be installed to use the mod. public bool IsRequired { get; } /********* ** Public methods *********/ /// Construct an instance. /// The toolkit instance. public ManifestDependency(Toolkit.Serialisation.Models.ManifestDependency dependency) : this(dependency.UniqueID, dependency.MinimumVersion?.ToString(), dependency.IsRequired) { } /// Construct an instance. /// The unique mod ID to require. /// The minimum required version (if any). /// Whether the dependency must be installed to use the mod. public ManifestDependency(string uniqueID, string minimumVersion, bool required = true) { this.UniqueID = uniqueID; this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion) ? new SemanticVersion(minimumVersion) : null; this.IsRequired = required; } } }