public static List <MCMModuleInfo> GetLoadedSubModules()
        {
            //MBDebug.Print("Loading submodules...");
            var moduleInfoList = new List <ModuleInfo>();
            var moduleNames    = Utilities.GetModulesNames();

            foreach (var moduleName in moduleNames)
            {
                var moduleInfo = new ModuleInfo();
                moduleInfo.Load(moduleName);
                moduleInfoList.Add(moduleInfo);
            }
            var loadedSubmoduleTypes = _loadedSubmoduleTypesField?.GetValue(TaleWorlds.MountAndBlade.Module.CurrentModule) as IDictionary <string, Type> ?? new Dictionary <string, Type>();
            var modules = new List <MCMModuleInfo>();

            foreach (var moduleInfo in moduleInfoList)
            {
                var module = new MCMModuleInfo(moduleInfo);
                foreach (var subModule in moduleInfo.SubModules.Where(subModule => loadedSubmoduleTypes.ContainsKey(subModule.SubModuleClassType)))
                {
                    module.SubModuleInfos.Add(new MCMSubModuleInfo(module, subModule, loadedSubmoduleTypes[subModule.SubModuleClassType]));
                }
                modules.Add(module);
            }

            return(modules);
        }
 public MCMSubModuleInfo(MCMModuleInfo owner, SubModuleInfo subModuleInfo, Type subModuleType)
 {
     Owner         = owner;
     SubModuleInfo = subModuleInfo;
     SubModuleType = subModuleType;
 }