From 125bcbee56bf40cf82abc7fdb502f8cbc18546cf Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 13 Sep 2019 17:22:45 -0400 Subject: migrate to new project file format --- .../Framework/ModData/ModDatabase.cs | 65 ---------------------- 1 file changed, 65 deletions(-) delete mode 100644 src/StardewModdingAPI.Toolkit/Framework/ModData/ModDatabase.cs (limited to 'src/StardewModdingAPI.Toolkit/Framework/ModData/ModDatabase.cs') diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModData/ModDatabase.cs b/src/StardewModdingAPI.Toolkit/Framework/ModData/ModDatabase.cs deleted file mode 100644 index a9da884a..00000000 --- a/src/StardewModdingAPI.Toolkit/Framework/ModData/ModDatabase.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace StardewModdingAPI.Toolkit.Framework.ModData -{ - /// Handles access to SMAPI's internal mod metadata list. - public class ModDatabase - { - /********* - ** Fields - *********/ - /// The underlying mod data records indexed by default display name. - private readonly ModDataRecord[] Records; - - /// Get an update URL for an update key (if valid). - private readonly Func GetUpdateUrl; - - - /********* - ** Public methods - *********/ - /// Construct an empty instance. - public ModDatabase() - : this(new ModDataRecord[0], key => null) { } - - /// Construct an instance. - /// The underlying mod data records indexed by default display name. - /// Get an update URL for an update key (if valid). - public ModDatabase(IEnumerable records, Func getUpdateUrl) - { - this.Records = records.ToArray(); - this.GetUpdateUrl = getUpdateUrl; - } - - /// Get all mod data records. - public IEnumerable GetAll() - { - return this.Records; - } - - /// Get a mod data record. - /// The unique mod ID. - public ModDataRecord Get(string modID) - { - return !string.IsNullOrWhiteSpace(modID) - ? this.Records.FirstOrDefault(p => p.HasID(modID)) - : null; - } - - /// Get the mod page URL for a mod (if available). - /// The unique mod ID. - public string GetModPageUrlFor(string id) - { - // get update key - ModDataRecord record = this.Get(id); - ModDataField updateKeyField = record?.Fields.FirstOrDefault(p => p.Key == ModDataFieldKey.UpdateKey); - if (updateKeyField == null) - return null; - - // get update URL - return this.GetUpdateUrl(updateKeyField.Value); - } - } -} -- cgit