summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
commitc8ad50dad1d706a1901798f9396f6becfea36c0e (patch)
tree28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs
parent451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff)
parentf78093bdb58d477b400cde3f19b70ffd6ddf833d (diff)
downloadSMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs')
-rw-r--r--src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs
index 1eb80889..f7dc8aa8 100644
--- a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs
+++ b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs
@@ -1,3 +1,5 @@
+using System.Diagnostics.CodeAnalysis;
+
namespace StardewModdingAPI.Toolkit.Serialization.Models
{
/// <summary>Indicates which mod can read the content pack represented by the containing manifest.</summary>
@@ -7,9 +9,36 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models
** Accessors
*********/
/// <summary>The unique ID of the mod which can read this content pack.</summary>
- public string UniqueID { get; set; }
+ public string UniqueID { get; }
/// <summary>The minimum required version (if any).</summary>
- public ISemanticVersion MinimumVersion { get; set; }
+ public ISemanticVersion? MinimumVersion { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="uniqueId">The unique ID of the mod which can read this content pack.</param>
+ /// <param name="minimumVersion">The minimum required version (if any).</param>
+ public ManifestContentPackFor(string uniqueId, ISemanticVersion? minimumVersion)
+ {
+ this.UniqueID = this.NormalizeWhitespace(uniqueId);
+ this.MinimumVersion = minimumVersion;
+ }
+
+
+ /*********
+ ** Private methods
+ *********/
+ /// <summary>Normalize whitespace in a raw string.</summary>
+ /// <param name="input">The input to strip.</param>
+#if NET5_0_OR_GREATER
+ [return: NotNullIfNotNull("input")]
+#endif
+ private string? NormalizeWhitespace(string? input)
+ {
+ return input?.Trim();
+ }
}
}