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.ModBuildConfig | |
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.ModBuildConfig')
-rw-r--r-- | src/SMAPI.ModBuildConfig/DeployModTask.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/SMAPI.ModBuildConfig/DeployModTask.cs b/src/SMAPI.ModBuildConfig/DeployModTask.cs index 357e02b5..70761a2f 100644 --- a/src/SMAPI.ModBuildConfig/DeployModTask.cs +++ b/src/SMAPI.ModBuildConfig/DeployModTask.cs @@ -9,6 +9,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Newtonsoft.Json; using StardewModdingAPI.ModBuildConfig.Framework; +using StardewModdingAPI.Toolkit.Framework; using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Serialization.Models; using StardewModdingAPI.Toolkit.Utilities; @@ -91,7 +92,8 @@ namespace StardewModdingAPI.ModBuildConfig try { new JsonHelper().ReadJsonFileIfExists(manifestFile.FullName, out manifest); - } catch (JsonReaderException ex) + } + catch (JsonReaderException ex) { // log the inner exception, otherwise the message will be generic Exception exToShow = ex.InnerException ?? ex; @@ -100,7 +102,7 @@ namespace StardewModdingAPI.ModBuildConfig } // validate the manifest's fields - if (!manifest.TryValidate(out string error)) + if (!ManifestValidator.TryValidate(manifest, out string error)) { this.Log.LogError($"[mod build package] The mod manifest is invalid: {error}"); return false; |