public static void LoadedFiles()
 {
     if (CommandManager.LoadedFileIDs.Count == 0)
     {
         CFormat.WriteLine("[CommandManager] There are no external files loaded.", ConsoleColor.Gray);
     }
     else
     {
         CFormat.WriteLine("[CommandManager] List of loaded files: ", ConsoleColor.Gray);
         foreach (FileID listLoadedFile in CommandManager.LoadedFileIDs)
         {
             CFormat.WriteLine(string.Format("{0}({1}) {2}", CFormat.Indent(2), listLoadedFile.ID, listLoadedFile.Path), ConsoleColor.Gray);
         }
     }
 }
        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;
            }
        }
        public static void Help(string stringCall = null)
        {
            if (stringCall == null)
            {
                List();
            }
            else
            {
                try
                {
                    // if the call is a library
                    if (!stringCall.Contains(' ') && !stringCall.Contains('.'))
                    {
                        Type library = CParsedInput.ParseLibrary(stringCall);

                        if (library == null)
                        {
                            CFormat.WriteLine("This library does not exist.");
                            return;
                        }

                        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);
                        }
                    }
                    else
                    {
                        CParsedInput parsedInput = new CParsedInput(stringCall, true);

                        string helpPrompt = parsedInput.CommandMethodInfo.GetCustomAttribute <MMasterCommand>().HelpPrompt;

                        if (helpPrompt == "")
                        {
                            CFormat.WriteLine(CFormat.GetArgsFormat(parsedInput.FullCallName, parsedInput.CommandMethodInfo.GetParameters()));
                        }
                        else
                        {
                            CFormat.WriteLine(helpPrompt, CFormat.GetArgsFormat(parsedInput.FullCallName, parsedInput.CommandMethodInfo.GetParameters()));
                        }
                    }
                }
                catch (WrongCallFormatException)
                {
                    CFormat.WriteLine("Wrong call format.", "The call should be as it follows: <Library>.<Command> [arg1] [arg2] [etc.]");
                }
                catch (LibraryNotExistingException)
                {
                    CFormat.WriteLine("This library does not exist.");
                }
                catch (CommandNotExistingException)
                {
                    CFormat.WriteLine("This command does not exist.");
                }
            }
        }