summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/ModHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModHelper.cs')
-rw-r--r--src/StardewModdingAPI/Framework/ModHelper.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Framework/ModHelper.cs b/src/StardewModdingAPI/Framework/ModHelper.cs
index 04767de5..0d50201b 100644
--- a/src/StardewModdingAPI/Framework/ModHelper.cs
+++ b/src/StardewModdingAPI/Framework/ModHelper.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using StardewModdingAPI.Advanced;
using StardewModdingAPI.Framework.Reflection;
using StardewModdingAPI.Framework.Serialisation;
@@ -14,6 +15,9 @@ 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
@@ -61,6 +65,13 @@ 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
****/
@@ -69,7 +80,9 @@ namespace StardewModdingAPI.Framework
public TConfig ReadConfig<TConfig>()
where TConfig : class, new()
{
- var config = this.ReadJsonFile<TConfig>("config.json") ?? new TConfig();
+ 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;
}