summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit/ModToolkit.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-06-27 00:40:31 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-06-27 00:40:31 -0400
commit82306a2c50f4d3df33d8ce62ca49628baf0cc3b7 (patch)
treea266bd5180a59c0730434dff7bb4041f75b6e68e /src/StardewModdingAPI.Toolkit/ModToolkit.cs
parent5f19e4f2035c36f9c6c882da3767d6f29409db1c (diff)
downloadSMAPI-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.cs6
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>