From db7247f36d11c870ec7b54bf6ea8b5b036065288 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 28 Jun 2018 20:51:49 -0400 Subject: simplify mod DB method (#532) --- src/SMAPI/Program.cs | 2 +- src/StardewModdingAPI.Toolkit/ModToolkit.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 6f1fe761..150ed34a 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -415,7 +415,7 @@ namespace StardewModdingAPI // load mod data ModToolkit toolkit = new ModToolkit(); - ModDatabase modDatabase = toolkit.GetModDatabase(Constants.ApiMetadataPath, toolkit.GetUpdateUrl); + ModDatabase modDatabase = toolkit.GetModDatabase(Constants.ApiMetadataPath); // load mods { diff --git a/src/StardewModdingAPI.Toolkit/ModToolkit.cs b/src/StardewModdingAPI.Toolkit/ModToolkit.cs index 7b678f3d..18fe1ff3 100644 --- a/src/StardewModdingAPI.Toolkit/ModToolkit.cs +++ b/src/StardewModdingAPI.Toolkit/ModToolkit.cs @@ -46,17 +46,16 @@ namespace StardewModdingAPI.Toolkit /// Get SMAPI's internal mod database. /// The file path for the SMAPI metadata file. - /// Get an update URL for an update key (if valid). - public ModDatabase GetModDatabase(string metadataPath, Func getUpdateUrl) + public ModDatabase GetModDatabase(string metadataPath) { MetadataModel metadata = JsonConvert.DeserializeObject(File.ReadAllText(metadataPath)); ModDataRecord[] records = metadata.ModData.Select(pair => new ModDataRecord(pair.Key, pair.Value)).ToArray(); - return new ModDatabase(records, getUpdateUrl); + return new ModDatabase(records, this.GetUpdateUrl); } /// Get an update URL for an update key (if valid). /// The update key. - internal string GetUpdateUrl(string updateKey) + public string GetUpdateUrl(string updateKey) { string[] parts = updateKey.Split(new[] { ':' }, 2); if (parts.Length != 2) -- cgit