diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-12 20:12:47 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-12 20:12:47 -0400 |
commit | 183fb9ff6e66e519ee9c0e3a3357504e8caf662a (patch) | |
tree | 85cf57e27d879da6ceb79d820642abe917e4573e /src/StardewModdingAPI/Framework | |
parent | 6a87f3566fcdde312483a5e9a0ec0698aa95d3b6 (diff) | |
download | SMAPI-183fb9ff6e66e519ee9c0e3a3357504e8caf662a.tar.gz SMAPI-183fb9ff6e66e519ee9c0e3a3357504e8caf662a.tar.bz2 SMAPI-183fb9ff6e66e519ee9c0e3a3357504e8caf662a.zip |
remove unused IConfigFile (#238)
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r-- | src/StardewModdingAPI/Framework/ModHelper.cs | 15 | ||||
-rw-r--r-- | src/StardewModdingAPI/Framework/Serialisation/JsonHelper.cs | 14 |
2 files changed, 3 insertions, 26 deletions
diff --git a/src/StardewModdingAPI/Framework/ModHelper.cs b/src/StardewModdingAPI/Framework/ModHelper.cs index 0d50201b..c8c44dba 100644 --- a/src/StardewModdingAPI/Framework/ModHelper.cs +++ b/src/StardewModdingAPI/Framework/ModHelper.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using StardewModdingAPI.Advanced; using StardewModdingAPI.Framework.Reflection; using StardewModdingAPI.Framework.Serialisation; @@ -15,9 +14,6 @@ namespace StardewModdingAPI.Framework /// <summary>Encapsulates SMAPI's JSON file parsing.</summary> private readonly JsonHelper JsonHelper; - /// <summary>Manages deprecation warnings.</summary> - private static DeprecationManager DeprecationManager; - /********* ** Accessors @@ -65,13 +61,6 @@ namespace StardewModdingAPI.Framework this.ConsoleCommands = new CommandHelper(modName, commandManager); } - /// <summary>Injects types required for backwards compatibility.</summary> - /// <param name="deprecationManager">Manages deprecation warnings.</param> - internal static void Shim(DeprecationManager deprecationManager) - { - ModHelper.DeprecationManager = deprecationManager; - } - /**** ** Mod config file ****/ @@ -81,8 +70,6 @@ namespace StardewModdingAPI.Framework where TConfig : class, new() { TConfig config = this.ReadJsonFile<TConfig>("config.json") ?? new TConfig(); - if (config is IConfigFile) - ModHelper.DeprecationManager.Warn($"{nameof(IConfigFile)}", "1.9", DeprecationLevel.Info); this.WriteConfig(config); // create file or fill in missing fields return config; } @@ -107,7 +94,7 @@ namespace StardewModdingAPI.Framework where TModel : class { path = Path.Combine(this.DirectoryPath, path); - return this.JsonHelper.ReadJsonFile<TModel>(path, this); + return this.JsonHelper.ReadJsonFile<TModel>(path); } /// <summary>Save to a JSON file.</summary> diff --git a/src/StardewModdingAPI/Framework/Serialisation/JsonHelper.cs b/src/StardewModdingAPI/Framework/Serialisation/JsonHelper.cs index d5f5bfd0..bd15c7bb 100644 --- a/src/StardewModdingAPI/Framework/Serialisation/JsonHelper.cs +++ b/src/StardewModdingAPI/Framework/Serialisation/JsonHelper.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using Microsoft.Xna.Framework.Input; using Newtonsoft.Json; -using StardewModdingAPI.Advanced; namespace StardewModdingAPI.Framework.Serialisation { @@ -31,9 +30,8 @@ namespace StardewModdingAPI.Framework.Serialisation /// <summary>Read a JSON file.</summary> /// <typeparam name="TModel">The model type.</typeparam> /// <param name="fullPath">The absolete file path.</param> - /// <param name="modHelper">The mod helper to inject for <see cref="IConfigFile"/> instances.</param> /// <returns>Returns the deserialised model, or <c>null</c> if the file doesn't exist or is empty.</returns> - public TModel ReadJsonFile<TModel>(string fullPath, IModHelper modHelper) + public TModel ReadJsonFile<TModel>(string fullPath) where TModel : class { // read file @@ -48,15 +46,7 @@ namespace StardewModdingAPI.Framework.Serialisation } // deserialise model - TModel model = JsonConvert.DeserializeObject<TModel>(json, this.JsonSettings); - if (model is IConfigFile) - { - var wrapper = (IConfigFile)model; - wrapper.ModHelper = modHelper; - wrapper.FilePath = fullPath; - } - - return model; + return JsonConvert.DeserializeObject<TModel>(json, this.JsonSettings); } /// <summary>Save to a JSON file.</summary> |