|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- using uREPL;
- using RobocraftX.CommandLine.Custom;
-
- namespace GamecraftModdingAPI.Commands
- {
- /// <summary>
- /// Convenient methods for registering commands to Gamecraft.
- /// All methods register to the command line and console block by default.
- /// </summary>
- public static class CommandRegistrationHelper
- {
- public static void Register(string name, Action action, string desc, bool noConsole = false)
- {
- RuntimeCommands.Register(name, action, desc);
- if (noConsole) { return; }
- ConsoleCommands.Register(name, action, desc);
- }
-
- public static void Register(string name, Action<object> action, string desc, bool noConsole = false)
- {
- Register<object>(name, action, desc, noConsole);
- }
-
- public static void Register(string name, Action<object, object> action, string desc, bool noConsole = false)
- {
- Register<object, object>(name, action, desc, noConsole);
- }
-
- public static void Register(string name, Action<object, object, object> action, string desc, bool noConsole = false)
- {
- Register<object, object, object>(name, action, desc, noConsole);
- }
-
- public static void Register<Param0>(string name, Action<Param0> action, string desc, bool noConsole = false)
- {
- RuntimeCommands.Register<Param0>(name, action, desc);
- if (noConsole) { return; }
- ConsoleCommands.Register<Param0>(name, action, desc);
- }
-
- public static void Register<Param0, Param1>(string name, Action<Param0, Param1> action, string desc, bool noConsole = false)
- {
- RuntimeCommands.Register<Param0, Param1>(name, action, desc);
- if (noConsole) { return; }
- ConsoleCommands.Register<Param0, Param1>(name, action, desc);
- }
-
- public static void Register<Param0, Param1, Param2>(string name, Action<Param0, Param1, Param2> action, string desc, bool noConsole = false)
- {
- RuntimeCommands.Register<Param0, Param1, Param2>(name, action, desc);
- if (noConsole) { return; }
- ConsoleCommands.Register<Param0, Param1, Param2>(name, action, desc);
- }
-
- public static void Unregister(string name, bool noConsole = false)
- {
- RuntimeCommands.Unregister(name);
- if (noConsole) { return; }
- ConsoleCommands.Unregister(name);
- }
- }
- }
|