/// <summary> /// Register a console command with an example of usage and a help description /// e.g. SmartConsole.RegisterCommand( "echo", "echo /// <string>", "writes <string> to the console log", SmartConsole.Echo ); /// </summary> public static void RegisterCommand(string name, string exampleUsage, string helpDescription, ConsoleCommandFunction callback) { var commandName = name.ToLower(); var command = new Command { Name = commandName, ParamsExample = exampleUsage, Help = helpDescription, Callback = callback }; CommandDictionary.Add(commandName, command); MasterDictionary.Add(commandName, command); }
/// <summary> /// Register a console command /// e.g. SmartConsole.RegisterCommand( "foo", Foo ); /// </summary> public static void RegisterCommand(string name, ConsoleCommandFunction callback) { RegisterCommand(name, "", "(no description)", callback); }
/// <summary> /// Register a console command with a help description /// e.g. SmartConsole.RegisterCommand( "help", "displays help information for console command where available", SmartConsole.Help ); /// </summary> public static void RegisterCommand(string name, string helpDescription, ConsoleCommandFunction callback) { RegisterCommand(name, "", helpDescription, callback); }
/// <summary> /// Register a console command with an example of usage and a help description /// e.g. SmartConsole.RegisterCommand( "echo", "echo <string>", "writes <string> to the console log", SmartConsole.Echo ); /// </summary> public static void RegisterCommand(string name, string exampleUsage, string helpDescription, ConsoleCommandFunction callback) { Command command = new Command(); command.m_name = name; command.m_paramsExample = exampleUsage; command.m_help = helpDescription; command.m_callback = callback; s_commandDictionary.Add(name, command); s_masterDictionary.Add(name, command); }