diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 00:40:31 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 00:40:31 -0400 |
commit | 82306a2c50f4d3df33d8ce62ca49628baf0cc3b7 (patch) | |
tree | a266bd5180a59c0730434dff7bb4041f75b6e68e /src/StardewModdingAPI.Toolkit/ModToolkit.cs | |
parent | 5f19e4f2035c36f9c6c882da3767d6f29409db1c (diff) | |
download | SMAPI-82306a2c50f4d3df33d8ce62ca49628baf0cc3b7.tar.gz SMAPI-82306a2c50f4d3df33d8ce62ca49628baf0cc3b7.tar.bz2 SMAPI-82306a2c50f4d3df33d8ce62ca49628baf0cc3b7.zip |
encapsulate mod DB a bit better for use outside SMAPI (#532)
Diffstat (limited to 'src/StardewModdingAPI.Toolkit/ModToolkit.cs')
-rw-r--r-- | src/StardewModdingAPI.Toolkit/ModToolkit.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/StardewModdingAPI.Toolkit/ModToolkit.cs b/src/StardewModdingAPI.Toolkit/ModToolkit.cs index 1723991e..7b678f3d 100644 --- a/src/StardewModdingAPI.Toolkit/ModToolkit.cs +++ b/src/StardewModdingAPI.Toolkit/ModToolkit.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -48,8 +49,9 @@ namespace StardewModdingAPI.Toolkit /// <param name="getUpdateUrl">Get an update URL for an update key (if valid).</param> public ModDatabase GetModDatabase(string metadataPath, Func<string, string> getUpdateUrl) { - SMetadata metadata = JsonConvert.DeserializeObject<SMetadata>(File.ReadAllText(metadataPath)); - return new ModDatabase(metadata.ModData, getUpdateUrl); + MetadataModel metadata = JsonConvert.DeserializeObject<MetadataModel>(File.ReadAllText(metadataPath)); + ModDataRecord[] records = metadata.ModData.Select(pair => new ModDataRecord(pair.Key, pair.Value)).ToArray(); + return new ModDatabase(records, getUpdateUrl); } /// <summary>Get an update URL for an update key (if valid).</summary> |