| 898 | } |
| 899 | |
| 900 | void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) |
| 901 | { |
| 902 | int argcount = command->ArgC(); |
| 903 | if (argcount >= 3) |
| 904 | { |
| 905 | const char *cmd = command->Arg(2); |
| 906 | if (strcmp(cmd, "list") == 0) |
| 907 | { |
| 908 | List<CExtension *>::iterator iter; |
| 909 | CExtension *pExt; |
| 910 | unsigned int num = 1; |
| 911 | |
| 912 | switch (m_Libs.size()) |
| 913 | { |
| 914 | case 1: |
| 915 | { |
| 916 | rootmenu->ConsolePrint("[SM] Displaying 1 extension:"); |
| 917 | break; |
| 918 | } |
| 919 | case 0: |
| 920 | { |
| 921 | rootmenu->ConsolePrint("[SM] No extensions are loaded."); |
| 922 | break; |
| 923 | } |
| 924 | default: |
| 925 | { |
| 926 | rootmenu->ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size()); |
| 927 | break; |
| 928 | } |
| 929 | } |
| 930 | for (iter = m_Libs.begin(); iter != m_Libs.end(); iter++,num++) |
| 931 | { |
| 932 | pExt = (*iter); |
| 933 | if (pExt->IsLoaded()) |
| 934 | { |
| 935 | char error[255]; |
| 936 | if (!pExt->IsRunning(error, sizeof(error))) |
| 937 | { |
| 938 | rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error); |
| 939 | } |
| 940 | else |
| 941 | { |
| 942 | IExtensionInterface *pAPI = pExt->GetAPI(); |
| 943 | const char *name = pAPI->GetExtensionName(); |
| 944 | const char *version = pAPI->GetExtensionVerString(); |
| 945 | const char *descr = pAPI->GetExtensionDescription(); |
| 946 | rootmenu->ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr); |
| 947 | } |
| 948 | } |
| 949 | else if(pExt->IsRequired() || libsys->PathExists(pExt->GetPath())) |
| 950 | { |
| 951 | rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str()); |
| 952 | } |
| 953 | else |
| 954 | { |
| 955 | rootmenu->ConsolePrint("[%02d] <OPTIONAL> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str()); |
| 956 | } |
| 957 | } |
nothing calls this directly
no test coverage detected