diff options
Diffstat (limited to 'src/StardewModdingAPI/Framework/Models/ManifestDependency.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/Models/ManifestDependency.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs new file mode 100644 index 00000000..67f906e3 --- /dev/null +++ b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs @@ -0,0 +1,42 @@ +namespace StardewModdingAPI.Framework.Models +{ + /// <summary>A mod dependency listed in a mod manifest.</summary> + internal class ManifestDependency : IManifestDependency + { + /********* + ** Accessors + *********/ + /// <summary>The unique mod ID to require.</summary> + public string UniqueID { get; set; } + + /// <summary>The minimum required version (if any).</summary> + public ISemanticVersion MinimumVersion { get; set; } + +#if !SMAPI_1_x + /// <summary>Whether the dependency must be installed to use the mod.</summary> + public bool IsRequired { get; set; } +#endif + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="uniqueID">The unique mod ID to require.</param> + /// <param name="minimumVersion">The minimum required version (if any).</param> + /// <param name="required">Whether the dependency must be installed to use the mod.</param> + public ManifestDependency(string uniqueID, string minimumVersion +#if !SMAPI_1_x + , bool required = true +#endif + ) + { + this.UniqueID = uniqueID; + this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion) + ? new SemanticVersion(minimumVersion) + : null; +#if !SMAPI_1_x + this.IsRequired = required; +#endif + } + } +} |