diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-11-10 23:27:38 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-11-10 23:27:38 -0500 |
commit | 346fddda670704c1458e42104ee7405fc1de7ccc (patch) | |
tree | f84d2f8915b1c9ccb90a5dbf0de48a9f85c4b18b /src/SMAPI | |
parent | 55eec58eafb9ba07f3e8b0a1c8394cb114de17a0 (diff) | |
download | SMAPI-346fddda670704c1458e42104ee7405fc1de7ccc.tar.gz SMAPI-346fddda670704c1458e42104ee7405fc1de7ccc.tar.bz2 SMAPI-346fddda670704c1458e42104ee7405fc1de7ccc.zip |
move validation logic out of Manifest model
This avoids tightly coupling higher logic to the implementation class, since we can validate the interface.
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModResolver.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 352c22cc..0b4fe3e9 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using StardewModdingAPI.Toolkit; +using StardewModdingAPI.Toolkit.Framework; using StardewModdingAPI.Toolkit.Framework.ModData; using StardewModdingAPI.Toolkit.Framework.ModScanning; using StardewModdingAPI.Toolkit.Framework.UpdateData; @@ -138,7 +139,7 @@ namespace StardewModdingAPI.Framework.ModLoading } // validate manifest - if (mod.Manifest is Manifest manifest && !manifest.TryValidate(out string manifestError)) + if (!ManifestValidator.TryValidate(mod.Manifest, out string manifestError)) { mod.SetStatus(ModMetadataStatus.Failed, ModFailReason.InvalidManifest, $"its {manifestError}"); continue; |