summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-23 20:44:49 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-23 20:44:49 -0500
commit0ed5f3e98eb90d5c7fbdc1cdf726c139c46a9ecf (patch)
treea67d36089f7923bf6fac075a6439df47ffdfba2b
parent26266a946dc1cbea18aef95bd04e9f2951c14b4c (diff)
downloadSMAPI-0ed5f3e98eb90d5c7fbdc1cdf726c139c46a9ecf.tar.gz
SMAPI-0ed5f3e98eb90d5c7fbdc1cdf726c139c46a9ecf.tar.bz2
SMAPI-0ed5f3e98eb90d5c7fbdc1cdf726c139c46a9ecf.zip
fix compatibility with mods which use the previous signature of Command.CallCommand
-rw-r--r--src/StardewModdingAPI/Command.cs10
-rw-r--r--src/StardewModdingAPI/Program.cs8
2 files changed, 18 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Command.cs b/src/StardewModdingAPI/Command.cs
index ef4ca2d8..1fa18d49 100644
--- a/src/StardewModdingAPI/Command.cs
+++ b/src/StardewModdingAPI/Command.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using StardewModdingAPI.Events;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI
{
@@ -68,6 +69,15 @@ namespace StardewModdingAPI
****/
/// <summary>Parse a command string and invoke it if valid.</summary>
/// <param name="input">The command to run, including the command name and any arguments.</param>
+ [Obsolete("Use the overload which passes in your mod's monitor")]
+ public static void CallCommand(string input)
+ {
+ Program.DeprecationManager.Warn($"an old version of {nameof(Command)}.{nameof(Command.CallCommand)}", "1.1", DeprecationLevel.Notice);
+ Command.CallCommand(input, Program.GetLegacyMonitorForMod());
+ }
+
+ /// <summary>Parse a command string and invoke it if valid.</summary>
+ /// <param name="input">The command to run, including the command name and any arguments.</param>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
public static void CallCommand(string input, IMonitor monitor)
{
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 0871e98a..14dbafc9 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -161,6 +161,14 @@ namespace StardewModdingAPI
}
}
+ /// <summary>Get a monitor for legacy code which doesn't have one passed in.</summary>
+ [Obsolete("This method should only be used when needed for backwards compatibility.")]
+ internal static IMonitor GetLegacyMonitorForMod()
+ {
+ string modName = Program.ModRegistry.GetModFromStack() ?? "unknown";
+ return new Monitor(modName, Program.LogFile);
+ }
+
/*********
** Private methods