summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Program.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-13 18:58:19 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-13 18:58:19 -0400
commit9b6c0d1021b07ec04b589f1bd0eb69e36082b600 (patch)
tree86e233e2ce4738677a86121fd510dd30f9a93045 /src/StardewModdingAPI/Program.cs
parent63edebaef1019ce103f5a86d55e1d1c4eb8d371c (diff)
downloadSMAPI-9b6c0d1021b07ec04b589f1bd0eb69e36082b600.tar.gz
SMAPI-9b6c0d1021b07ec04b589f1bd0eb69e36082b600.tar.bz2
SMAPI-9b6c0d1021b07ec04b589f1bd0eb69e36082b600.zip
decouple reading manifest files from validating metadata (#285)
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r--src/StardewModdingAPI/Program.cs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index c8840538..74a9ff8e 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -313,12 +313,12 @@ namespace StardewModdingAPI
// load mods
int modsLoaded;
{
- // get mod metadata (in dependency order)
this.Monitor.Log("Loading mod metadata...");
- JsonHelper jsonHelper = new JsonHelper();
- ModMetadata[] mods = new ModResolver(this.Settings.ModCompatibility)
- .GetMods(Constants.ModPath, new JsonHelper())
- .ToArray();
+ ModResolver resolver = new ModResolver();
+
+ // load manifests
+ ModMetadata[] mods = resolver.ReadManifests(Constants.ModPath, new JsonHelper(), this.Settings.ModCompatibility).ToArray();
+ resolver.ValidateManifests(mods);
// check for deprecated metadata
IList<Action> deprecationWarnings = new List<Action>();
@@ -326,7 +326,7 @@ namespace StardewModdingAPI
{
// missing unique ID
if (string.IsNullOrWhiteSpace(mod.Manifest.UniqueID))
- deprecationWarnings.Add(() => this.Monitor.Log($"{mod.DisplayName} doesn't have specify a {nameof(IManifest.UniqueID)} field in its manifest. This will be required in an upcoming SMAPI release.", LogLevel.Warn));
+ deprecationWarnings.Add(() => this.Monitor.Log($"{mod.DisplayName} doesn't have specify a {nameof(IManifest.UniqueID)} field in its manifest. This will be required in an upcoming SMAPI release.", LogLevel.Warn));
// per-save directories
if ((mod.Manifest as Manifest)?.PerSaveConfigs == true)
@@ -350,8 +350,11 @@ namespace StardewModdingAPI
}
}
+ // process dependencies
+ mods = resolver.ProcessDependencies(mods).ToArray();
+
// load mods
- modsLoaded = this.LoadMods(mods, jsonHelper, (SContentManager)Game1.content, deprecationWarnings);
+ modsLoaded = this.LoadMods(mods, new JsonHelper(), (SContentManager)Game1.content, deprecationWarnings);
foreach (Action warning in deprecationWarnings)
warning();
}
@@ -515,7 +518,7 @@ namespace StardewModdingAPI
// get basic info
IManifest manifest = metadata.Manifest;
string assemblyPath = Path.Combine(metadata.DirectoryPath, metadata.Manifest.EntryDll);
-
+
// preprocess & load mod assembly
Assembly modAssembly;
try