public static void Reload() { CommandManager.ClearExternalCommands(); CFormat.WriteLine("[CommandManager] Cleared loaded external commands.", ConsoleColor.Gray); CFormat.JumpLine(); CommandManager.LoadExternalCommands(true); }
public static void UnloadFile() { LoadedFiles(); CFormat.JumpLine(); CFormat.WriteLine("Please enter the number ID of the file you want to unload.", ConsoleColor.Gray); int id = CInput.UserPickInt(CommandManager.LoadedFileIDs.Count - 1); if (id == -1) { return; } CommandManager.UnloadFile(id); }
public static void List() { CFormat.WriteLine("For more information about a command, type 'Help <command>'.", ConsoleColor.Gray); CFormat.JumpLine(); CFormat.WriteLine("[Internal commands]", ConsoleColor.Green); foreach (Type library in CommandManager.InternalLibraryCallNames.Values) { if (CommandManager.InternalLibraries[library].Values.Count != 0) { string libraryCallName = CommandManager.InternalLibraryCallNames.FirstOrDefault(x => x.Value == library).Key; string libraryHelpPrompt = library.GetCustomAttribute <MMasterLibrary>().HelpPrompt; if (!String.IsNullOrEmpty(libraryHelpPrompt)) { libraryHelpPrompt = " (" + libraryHelpPrompt + ")"; } CFormat.WriteLine(libraryCallName + libraryHelpPrompt, ConsoleColor.Yellow); foreach (MethodInfo methodInfo in CommandManager.InternalLibraries[library].Values) { MMasterCommand mMasterCommand = methodInfo.GetCustomAttribute <MMasterCommand>(); string helpPrompt = mMasterCommand.HelpPrompt; if (!String.IsNullOrEmpty(helpPrompt)) { helpPrompt = " (" + helpPrompt + ")"; } CFormat.WriteLine(CFormat.Indent(3) + "." + methodInfo.Name + helpPrompt); } CFormat.JumpLine(); } } if (CommandManager.ExternalLibraryCallNames.Count == 0) { return; } CFormat.WriteLine("[External commands]", ConsoleColor.Green); int num = 1; foreach (Type library in CommandManager.ExternalLibraryCallNames.Values) { string libraryCallName = CommandManager.ExternalLibraryCallNames.FirstOrDefault(x => x.Value == library).Key; string libraryHelpPrompt = library.GetCustomAttribute <MMasterLibrary>().HelpPrompt; if (!String.IsNullOrEmpty(libraryHelpPrompt)) { libraryHelpPrompt = " (" + libraryHelpPrompt + ")"; } CFormat.WriteLine(libraryCallName + libraryHelpPrompt, ConsoleColor.Yellow); foreach (MethodInfo methodInfo in CommandManager.ExternalLibraries[library].Values) { MMasterCommand mMasterCommand = methodInfo.GetCustomAttribute <MMasterCommand>(); string helpPrompt = mMasterCommand.HelpPrompt; if (!String.IsNullOrEmpty(helpPrompt)) { helpPrompt = " (" + helpPrompt + ")"; } CFormat.WriteLine(CFormat.Indent(3) + "." + methodInfo.Name + helpPrompt); } if (num < CommandManager.ExternalLibraryCallNames.Values.Count) { CFormat.JumpLine(); } ++num; } }