diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-16 01:15:02 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-16 01:15:02 -0400 |
commit | f4a2d8100fa6553b79d3f91dfd7b2011ce453b79 (patch) | |
tree | 51fb43006cecca073e1d340e744d987bb937295c | |
parent | bca78cd682c0d583913811f632815db142fbde8b (diff) | |
download | SMAPI-f4a2d8100fa6553b79d3f91dfd7b2011ce453b79.tar.gz SMAPI-f4a2d8100fa6553b79d3f91dfd7b2011ce453b79.tar.bz2 SMAPI-f4a2d8100fa6553b79d3f91dfd7b2011ce453b79.zip |
add warning for mods that don't have a name or version
-rw-r--r-- | release-notes.md | 2 | ||||
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/release-notes.md b/release-notes.md index 507fb1af..d10ce4e1 100644 --- a/release-notes.md +++ b/release-notes.md @@ -26,7 +26,7 @@ For mod developers: _<small>This is set to `true` when the player has loaded a save and the world is finished initialising. This is set at the same point that `SaveEvents.AfterLoad` and `TimeEvents.AfterDayStarted` are raised, and is mainly useful with events which can be raised before the world is loaded.</small>_ * Added log entries for basic context changes (e.g. loaded save) to simplify troubleshooting. * Added a `debug` console command to TrainerMod which lets you pass debug commands to the game (e.g. `debug warp FarmHouse 1 1` warps the player to the farmhouse). -* Added a deprecation warning for mods that don't set the `UniqueID` manifest field, which will be required in SMAPI 2.0. +* Added a deprecation warning for mods that don't set the `Name`, `Version`, or `UniqueID` manifest fields. These will be required in SMAPI 2.0. * Mods can now override `Dispose` if they need to release unmanaged resources. * Deprecated `GameEvents.GameLoaded` and `GameEvents.FirstUpdateTick`, since any logic in the mod's `Entry` method will happen after the game is loaded. diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 1678c5fa..65b4d6dd 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -514,8 +514,23 @@ namespace StardewModdingAPI LogSkip(displayName, "its manifest doesn't set an entry DLL."); continue; } - if (string.IsNullOrWhiteSpace(manifest.UniqueID)) - deprecationWarnings.Add(() => this.Monitor.Log($"{manifest.Name} doesn't have a {nameof(IManifest.UniqueID)} in its manifest. This will be required in an upcoming SMAPI release.", LogLevel.Warn)); + + // log warnings for missing fields that will be required in SMAPI 2.0 + { + List<string> missingFields = new List<string>(3); + + if (string.IsNullOrWhiteSpace(manifest.Name)) + missingFields.Add(nameof(IManifest.Name)); + if (manifest.Version.ToString() == "0.0") + missingFields.Add(nameof(IManifest.Version)); + if (string.IsNullOrWhiteSpace(manifest.UniqueID)) + missingFields.Add(nameof(IManifest.UniqueID)); + + if (missingFields.Any()) + deprecationWarnings.Add(() => this.Monitor.Log($"{manifest.Name} is missing some manifest fields ({string.Join(", ", missingFields)}) which will be required in an upcoming SMAPI version.", LogLevel.Warn)); + } + + } catch (Exception ex) { |