diff options
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/IModMetadata.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModMetadata.cs | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs index 248809df..b7972fe1 100644 --- a/src/SMAPI/Framework/IModMetadata.cs +++ b/src/SMAPI/Framework/IModMetadata.cs @@ -65,6 +65,9 @@ namespace StardewModdingAPI.Framework /// <param name="api">The mod-provided API.</param> IModMetadata SetApi(object api); + /// <summary>Whether the mod manifest was loaded (regardless of whether the mod itself was loaded).</summary> + bool HasManifest(); + /// <summary>Whether the mod has at least one update key set.</summary> bool HasUpdateKeys(); } diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index af888b71..d3a33e7a 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -104,11 +104,18 @@ namespace StardewModdingAPI.Framework.ModLoading return this; } + /// <summary>Whether the mod manifest was loaded (regardless of whether the mod itself was loaded).</summary> + public bool HasManifest() + { + return this.Manifest != null; + } + /// <summary>Whether the mod has at least one update key set.</summary> public bool HasUpdateKeys() { return - this.Manifest?.UpdateKeys != null + this.HasManifest() + && this.Manifest.UpdateKeys != null && this.Manifest.UpdateKeys.Any(key => !string.IsNullOrWhiteSpace(key)); } } |