SEToolbox.Models.ExplorerModel.MergeData C# (CSharp) Method

MergeData() public method

public MergeData ( IList data ) : void
data IList
return void
        public void MergeData(IList<IStructureBase> data)
        {
            var idReplacementTable = new Dictionary<long, long>();

            foreach (var item in data)
            {
                if (item is StructureCubeGridModel)
                {
                    var ship = item as StructureCubeGridModel;
                    MergeData(ship.CubeGrid, ref idReplacementTable);
                }
                else if (item is StructureVoxelModel)
                {
                    var asteroid = item as StructureVoxelModel;

                    if (ContainsVoxelFilename(asteroid.Name, null))
                    {
                        asteroid.Name = CreateUniqueVoxelStorageName(asteroid.Name, null);
                    }

                    var entity = (StructureVoxelModel)AddEntity(asteroid.VoxelMap);
                    entity.EntityId = MergeId(asteroid.EntityId, ref idReplacementTable);

                    if (asteroid.SourceVoxelFilepath != null)
                        entity.SourceVoxelFilepath = asteroid.SourceVoxelFilepath;  // Source Voxel file is temporary. Hasn't been saved yet.
                    else
                        entity.SourceVoxelFilepath = asteroid.VoxelFilepath;  // Source Voxel file exists.
                }
                else if (item is StructurePlanetModel)
                {
                    var planet = item as StructurePlanetModel;

                    if (ContainsVoxelFilename(planet.Name, null))
                    {
                        planet.Name = CreateUniqueVoxelStorageName(planet.Name, null);
                    }

                    var entity = (StructurePlanetModel)AddEntity(planet.Planet);
                    entity.EntityId = MergeId(planet.EntityId, ref idReplacementTable);

                    if (planet.SourceVoxelFilepath != null)
                        entity.SourceVoxelFilepath = planet.SourceVoxelFilepath;  // Source Voxel file is temporary. Hasn't been saved yet.
                    else
                        entity.SourceVoxelFilepath = planet.VoxelFilepath;  // Source Voxel file exists.
                }
                else if (item is StructureFloatingObjectModel)
                {
                    var floatObject = item as StructureFloatingObjectModel;
                    var entity = AddEntity(floatObject.FloatingObject);
                    entity.EntityId = MergeId(floatObject.EntityId, ref idReplacementTable);
                }
                else if (item is StructureMeteorModel)
                {
                    var meteor = item as StructureMeteorModel;
                    var entity = AddEntity(meteor.Meteor);
                    entity.EntityId = MergeId(meteor.EntityId, ref idReplacementTable);
                }
                else if (item is StructureInventoryBagModel)
                {
                    var inventoryBag = item as StructureInventoryBagModel;
                    var entity = AddEntity(inventoryBag.EntityBase);
                    entity.EntityId = MergeId(inventoryBag.EntityId, ref idReplacementTable);
                }
                else if (item is StructureUnknownModel)
                {
                    var unknown = item as StructureUnknownModel;
                    var entity = AddEntity(unknown.EntityBase);
                    entity.EntityId = MergeId(unknown.EntityId, ref idReplacementTable);
                }

                // ignore the StructureCharacterModel.
            }
        }

Same methods

ExplorerModel::MergeData ( MyObjectBuilder_CubeGrid cubeGridObject, Int64>.Dictionary &idReplacementTable ) : void