diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-10 21:34:18 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-10 21:34:18 -0400 |
commit | 761f2d952b073b78a06453768992b7b0fd4c6463 (patch) | |
tree | b1f8dea96e2d6b629b9f2a8272ad11ae031674ea /src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs | |
parent | 0336fb252420194d518d6c21c3d1a8f372565c2f (diff) | |
download | SMAPI-761f2d952b073b78a06453768992b7b0fd4c6463.tar.gz SMAPI-761f2d952b073b78a06453768992b7b0fd4c6463.tar.bz2 SMAPI-761f2d952b073b78a06453768992b7b0fd4c6463.zip |
enable nullable annotations in mod data models (#837)
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs')
-rw-r--r-- | src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs index 4c09e1ba..e9ece387 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -22,7 +20,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData public string[] FormerIDs { get; } /// <summary>The mod warnings to suppress, even if they'd normally be shown.</summary> - public ModWarning SuppressWarnings { get; set; } + public ModWarning SuppressWarnings { get; } /// <summary>The versioned field data.</summary> public ModDataField[] Fields { get; } @@ -72,9 +70,9 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData } /// <summary>Get the default update key for this mod, if any.</summary> - public string GetDefaultUpdateKey() + public string? GetDefaultUpdateKey() { - string updateKey = this.Fields.FirstOrDefault(p => p.Key == ModDataFieldKey.UpdateKey && p.IsDefault)?.Value; + string? updateKey = this.Fields.FirstOrDefault(p => p.Key == ModDataFieldKey.UpdateKey && p.IsDefault)?.Value; return !string.IsNullOrWhiteSpace(updateKey) ? updateKey : null; @@ -84,7 +82,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData /// <param name="manifest">The manifest to match.</param> public ModDataRecordVersionedFields GetVersionedFields(IManifest manifest) { - ModDataRecordVersionedFields parsed = new() { DisplayName = this.DisplayName, DataRecord = this }; + ModDataRecordVersionedFields parsed = new(this); foreach (ModDataField field in this.Fields.Where(field => field.IsMatch(manifest))) { switch (field.Key) |