From ba590b20a6581323ac13fc63d380524789d49c97 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 19 Jan 2017 11:07:48 -0500 Subject: add public mod registry (#220) --- src/StardewModdingAPI/ModHelper.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/StardewModdingAPI/ModHelper.cs') diff --git a/src/StardewModdingAPI/ModHelper.cs b/src/StardewModdingAPI/ModHelper.cs index 78b3eefa..c20130cf 100644 --- a/src/StardewModdingAPI/ModHelper.cs +++ b/src/StardewModdingAPI/ModHelper.cs @@ -30,22 +30,31 @@ namespace StardewModdingAPI /// Simplifies access to private game code. public IReflectionHelper Reflection { get; } = new ReflectionHelper(); + /// Metadata about loaded mods. + public IModRegistry ModRegistry { get; } + /********* ** Public methods *********/ /// Construct an instance. /// The mod directory path. - public ModHelper(string modDirectory) + /// Metadata about loaded mods. + /// An argument is null or invalid. + /// The path does not exist on disk. + public ModHelper(string modDirectory, IModRegistry modRegistry) { // validate + if (modRegistry == null) + throw new ArgumentException("The mod registry cannot be null."); if (string.IsNullOrWhiteSpace(modDirectory)) - throw new InvalidOperationException("The mod directory cannot be empty."); + throw new ArgumentException("The mod directory cannot be empty."); if (!Directory.Exists(modDirectory)) throw new InvalidOperationException("The specified mod directory does not exist."); // initialise this.DirectoryPath = modDirectory; + this.ModRegistry = modRegistry; } /**** -- cgit