Example #1
0
        private static DesignSectionInfo GetDesignSectionInfoFromRow(
            Row row,
            SQLiteConnection db,
            AssetDatabase assets)
        {
            int               integer       = row[0].SQLiteValueToInteger();
            string            filename      = row[1].SQLiteValueToString();
            DesignSectionInfo designSection = new DesignSectionInfo()
            {
                ID               = integer,
                FilePath         = filename,
                ShipSectionAsset = assets.GetShipSectionAsset(filename),
                WeaponBanks      = DesignsCache.GetWeaponBankInfosForDesignSection(db, integer).ToList <WeaponBankInfo>(),
                Techs            = DesignsCache.GetTechsForDesignSection(db, integer).ToList <int>()
            };
            List <DesignModuleInfo> list = DesignsCache.GetModuleInfosForDesignSection(db, designSection).ToList <DesignModuleInfo>();

            designSection.Modules = new List <DesignModuleInfo>();
            foreach (LogicalModuleMount module in designSection.ShipSectionAsset.Modules)
            {
                LogicalModuleMount mount            = module;
                DesignModuleInfo   designModuleInfo = list.FirstOrDefault <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x => x.MountNodeName == mount.NodeName));
                if (designModuleInfo != null)
                {
                    designSection.Modules.Add(designModuleInfo);
                    list.Remove(designModuleInfo);
                }
            }
            return(designSection);
        }