diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 22:07:29 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 22:07:29 -0400 |
commit | 9495cc0f493a11960aa23551e164018681d08f79 (patch) | |
tree | 3071d9042394d95839400b2806405d5e2d3fb908 /src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs | |
parent | a89dbce8549abee867d0af65ac62155bb485a911 (diff) | |
download | SMAPI-9495cc0f493a11960aa23551e164018681d08f79.tar.gz SMAPI-9495cc0f493a11960aa23551e164018681d08f79.tar.bz2 SMAPI-9495cc0f493a11960aa23551e164018681d08f79.zip |
rename mod compatibility records for broader use (#361)
Diffstat (limited to 'src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs b/src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs deleted file mode 100644 index 98e70116..00000000 --- a/src/StardewModdingAPI/Framework/Models/ModCompatibilityID.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using Newtonsoft.Json; - -namespace StardewModdingAPI.Framework.Models -{ - /// <summary>Uniquely identifies a mod for compatibility checks.</summary> - internal class ModCompatibilityID - { - /********* - ** Accessors - *********/ - /// <summary>The unique mod ID.</summary> - public string ID { get; set; } - - /// <summary>The mod name to disambiguate non-unique IDs, or <c>null</c> to ignore the mod name.</summary> - public string Name { get; set; } - - /// <summary>The author name to disambiguate non-unique IDs, or <c>null</c> to ignore the author.</summary> - public string Author { get; set; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - public ModCompatibilityID() { } - - /// <summary>Construct an instance.</summary> - /// <param name="data">The mod ID or a JSON string matching the <see cref="ModCompatibilityID"/> fields.</param> - public ModCompatibilityID(string data) - { - // JSON can be stuffed into the ID string as a convenience hack to keep JSON mod lists - // formatted readably. The tradeoff is that the format is a bit more magical, but that's - // probably acceptable since players aren't meant to edit it. It's also fairly clear what - // the JSON strings do, if not necessarily how. - if (data.StartsWith("{")) - JsonConvert.PopulateObject(data, this); - else - this.ID = data; - } - - /// <summary>Get whether this ID matches a given mod manifest.</summary> - /// <param name="id">The mod's unique ID, or a substitute ID if it isn't set in the manifest.</param> - /// <param name="manifest">The manifest to check.</param> - public bool Matches(string id, IManifest manifest) - { - return - this.ID.Equals(id, StringComparison.InvariantCultureIgnoreCase) - && ( - this.Author == null - || this.Author.Equals(manifest.Author, StringComparison.InvariantCultureIgnoreCase) - || (manifest.ExtraFields.ContainsKey("Authour") && this.Author.Equals(manifest.ExtraFields["Authour"].ToString(), StringComparison.InvariantCultureIgnoreCase)) - ) - && (this.Name == null || this.Name.Equals(manifest.Name, StringComparison.InvariantCultureIgnoreCase)); - } - } -} |