summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs
blob: 25d92a2922c9c16cfb77b423cad5941a9bba2986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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_2_0
        /// <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_2_0
            , bool required = true
#endif
            )
        {
            this.UniqueID = uniqueID;
            this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion)
                ? new SemanticVersion(minimumVersion)
                : null;
#if SMAPI_2_0
            this.IsRequired = required;
#endif
        }
    }
}