diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-07-07 11:39:09 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-07-07 11:39:09 -0400 |
commit | f033b5a2f72b96168f6e20e96fa50742e70b01d6 (patch) | |
tree | 577e6eaad6c69f80e3c01fb8028bf195f6cbe358 /src/StardewModdingAPI/Framework/CommandHelper.cs | |
parent | c5e106801e9137078decfd6b6e3761240b47f94e (diff) | |
download | SMAPI-f033b5a2f72b96168f6e20e96fa50742e70b01d6.tar.gz SMAPI-f033b5a2f72b96168f6e20e96fa50742e70b01d6.tar.bz2 SMAPI-f033b5a2f72b96168f6e20e96fa50742e70b01d6.zip |
group mod helpers (#318)
Diffstat (limited to 'src/StardewModdingAPI/Framework/CommandHelper.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/CommandHelper.cs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/StardewModdingAPI/Framework/CommandHelper.cs b/src/StardewModdingAPI/Framework/CommandHelper.cs deleted file mode 100644 index 86734fc5..00000000 --- a/src/StardewModdingAPI/Framework/CommandHelper.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; - -namespace StardewModdingAPI.Framework -{ - /// <summary>Provides an API for managing console commands.</summary> - internal class CommandHelper : ICommandHelper - { - /********* - ** Accessors - *********/ - /// <summary>The friendly mod name for this instance.</summary> - private readonly string ModName; - - /// <summary>Manages console commands.</summary> - private readonly CommandManager CommandManager; - - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="modName">The friendly mod name for this instance.</param> - /// <param name="commandManager">Manages console commands.</param> - public CommandHelper(string modName, CommandManager commandManager) - { - this.ModName = modName; - this.CommandManager = commandManager; - } - - /// <summary>Add a console command.</summary> - /// <param name="name">The command name, which the user must type to trigger it.</param> - /// <param name="documentation">The human-readable documentation shown when the player runs the built-in 'help' command.</param> - /// <param name="callback">The method to invoke when the command is triggered. This method is passed the command name and arguments submitted by the user.</param> - /// <exception cref="ArgumentNullException">The <paramref name="name"/> or <paramref name="callback"/> is null or empty.</exception> - /// <exception cref="FormatException">The <paramref name="name"/> is not a valid format.</exception> - /// <exception cref="ArgumentException">There's already a command with that name.</exception> - public ICommandHelper Add(string name, string documentation, Action<string, string[]> callback) - { - this.CommandManager.Add(this.ModName, name, documentation, callback); - return this; - } - - /// <summary>Trigger a command.</summary> - /// <param name="name">The command name.</param> - /// <param name="arguments">The command arguments.</param> - /// <returns>Returns whether a matching command was triggered.</returns> - public bool Trigger(string name, string[] arguments) - { - return this.CommandManager.Trigger(name, arguments); - } - } -} |