diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-22 23:03:09 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-22 23:03:09 -0400 |
commit | ceac1de6ec7ed5f7ecc32cb99a665af891863657 (patch) | |
tree | 142fe10ea01e13ba881d4aa8b938dbb13e138ef8 /src/SMAPI | |
parent | 046c6be68ad5d48e69512116100797a974330d4b (diff) | |
download | SMAPI-ceac1de6ec7ed5f7ecc32cb99a665af891863657.tar.gz SMAPI-ceac1de6ec7ed5f7ecc32cb99a665af891863657.tar.bz2 SMAPI-ceac1de6ec7ed5f7ecc32cb99a665af891863657.zip |
change mod registry to return a container interface (#534)
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/IModMetadata.cs | 5 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs | 8 | ||||
-rw-r--r-- | src/SMAPI/IModInfo.cs | 9 | ||||
-rw-r--r-- | src/SMAPI/IModRegistry.cs | 4 | ||||
-rw-r--r-- | src/SMAPI/StardewModdingAPI.csproj | 1 |
5 files changed, 17 insertions, 10 deletions
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs index 2145105b..edd7eed6 100644 --- a/src/SMAPI/Framework/IModMetadata.cs +++ b/src/SMAPI/Framework/IModMetadata.cs @@ -5,7 +5,7 @@ using StardewModdingAPI.Toolkit.Framework.ModData; namespace StardewModdingAPI.Framework { /// <summary>Metadata for a mod.</summary> - internal interface IModMetadata + internal interface IModMetadata : IModInfo { /********* ** Accessors @@ -16,9 +16,6 @@ namespace StardewModdingAPI.Framework /// <summary>The mod's full directory path.</summary> string DirectoryPath { get; } - /// <summary>The mod manifest.</summary> - IManifest Manifest { get; } - /// <summary>Metadata about the mod from SMAPI's internal data (if any).</summary> ModDataRecordVersionedFields DataRecord { get; } diff --git a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs index 008a80f5..5cc2a20f 100644 --- a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs @@ -40,17 +40,17 @@ namespace StardewModdingAPI.Framework.ModHelpers } /// <summary>Get metadata for all loaded mods.</summary> - public IEnumerable<IManifest> GetAll() + public IEnumerable<IModInfo> GetAll() { - return this.Registry.GetAll().Select(p => p.Manifest); + return this.Registry.GetAll(); } /// <summary>Get metadata for a loaded mod.</summary> /// <param name="uniqueID">The mod's unique ID.</param> /// <returns>Returns the matching mod's metadata, or <c>null</c> if not found.</returns> - public IManifest Get(string uniqueID) + public IModInfo Get(string uniqueID) { - return this.Registry.Get(uniqueID)?.Manifest; + return this.Registry.Get(uniqueID); } /// <summary>Get whether a mod has been loaded.</summary> diff --git a/src/SMAPI/IModInfo.cs b/src/SMAPI/IModInfo.cs new file mode 100644 index 00000000..a16c2d7b --- /dev/null +++ b/src/SMAPI/IModInfo.cs @@ -0,0 +1,9 @@ +namespace StardewModdingAPI +{ + /// <summary>Metadata for a loaded mod.</summary> + public interface IModInfo + { + /// <summary>The mod manifest.</summary> + IManifest Manifest { get; } + } +} diff --git a/src/SMAPI/IModRegistry.cs b/src/SMAPI/IModRegistry.cs index a06e099e..10b3121e 100644 --- a/src/SMAPI/IModRegistry.cs +++ b/src/SMAPI/IModRegistry.cs @@ -6,12 +6,12 @@ namespace StardewModdingAPI public interface IModRegistry : IModLinked { /// <summary>Get metadata for all loaded mods.</summary> - IEnumerable<IManifest> GetAll(); + IEnumerable<IModInfo> GetAll(); /// <summary>Get metadata for a loaded mod.</summary> /// <param name="uniqueID">The mod's unique ID.</param> /// <returns>Returns the matching mod's metadata, or <c>null</c> if not found.</returns> - IManifest Get(string uniqueID); + IModInfo Get(string uniqueID); /// <summary>Get whether a mod has been loaded.</summary> /// <param name="uniqueID">The mod's unique ID.</param> diff --git a/src/SMAPI/StardewModdingAPI.csproj b/src/SMAPI/StardewModdingAPI.csproj index 713b1b31..740af15f 100644 --- a/src/SMAPI/StardewModdingAPI.csproj +++ b/src/SMAPI/StardewModdingAPI.csproj @@ -186,6 +186,7 @@ <Compile Include="Framework\StateTracking\PlayerTracker.cs" /> <Compile Include="Framework\Utilities\ContextHash.cs" /> <Compile Include="IContentPack.cs" /> + <Compile Include="IModInfo.cs" /> <Compile Include="IMultiplayerHelper.cs" /> <Compile Include="IReflectedField.cs" /> <Compile Include="IReflectedMethod.cs" /> |