Ejemplo n.º 1
0
        // See CompilePartInfo
        public static AvailablePart.ModuleInfo GetModuleInfo(PartModule pm)
        {
            AvailablePart.ModuleInfo moduleInfo = new AvailablePart.ModuleInfo();
            if (pm is IModuleInfo)
            {
                IModuleInfo iModuleInfo = pm as IModuleInfo;
                moduleInfo.moduleName  = iModuleInfo.GetModuleTitle();
                moduleInfo.info        = iModuleInfo.GetInfo().Trim();
                moduleInfo.primaryInfo = iModuleInfo.GetPrimaryField();
            }
            else
            {
                moduleInfo.moduleName = (pm.GUIName ?? KSPUtil.PrintModuleName(pm.moduleName));
                moduleInfo.info       = pm.GetInfo().Trim();
            }

            if (pm.showUpgradesInModuleInfo && pm.HasUpgrades())
            {
                moduleInfo.info += "\n" + pm.PrintUpgrades();
            }

            moduleInfo.moduleDisplayName = pm.GetModuleDisplayName();
            if (moduleInfo.moduleDisplayName == string.Empty)
            {
                moduleInfo.moduleDisplayName = moduleInfo.moduleName;
            }
            return(moduleInfo);
        }