private void LoadAllCommandsFromAssembly(Assembly assembly) { Trace.Assert(assembly != null); foreach (Type t in GetAllTypesThatImplement(assembly, typeof(IConsoleCommand))) { IConsoleCommand command = (IConsoleCommand)kernel.Get(t); commands.Add(command.GetName(), t); if (command.GetType().Assembly.FullName.IndexOf("js.net.test.module") < 0) { helpManager.AddHelpForConsoleCommand(command); } } }
public static void AddCommand(IConsoleCommand command) { // Add Command s_ConsoleData.commands.Add(command.GetName().ToUpper(), command); // Add Aliases var aliases = command.GetAliases(); if (aliases != null) { foreach (var alias in aliases) { if (!alias.AliasString.Contains(" ")) { s_ConsoleData.aliases.Add(alias.AliasString.ToUpper(), alias.Command); } else { Debug.LogError(string.Format("Cannot add alias for command {0} : alias '{1}' contains spaces", command.GetName(), alias.AliasString)); } } } }