private void clearCaravanFleet() { if (this.CaravanFleet.HasValue) { FleetInfo fleetInfo1 = this._app.GameDatabase.GetFleetInfo(this.CaravanFleet.Value); List <ShipInfo> list1 = this._app.GameDatabase.GetShipInfoByFleetID(fleetInfo1.ID, true).ToList <ShipInfo>(); List <FreighterInfo> list2 = this._app.GameDatabase.GetFreighterInfosBuiltByPlayer(this._app.LocalPlayer.ID).Where <FreighterInfo>((Func <FreighterInfo, bool>)(x => x.IsPlayerBuilt)).ToList <FreighterInfo>(); foreach (ShipInfo shipInfo in list1) { ShipInfo ship = shipInfo; if (list2.Any <FreighterInfo>((Func <FreighterInfo, bool>)(x => x.ShipId == ship.ID))) { this._app.GameDatabase.TransferShip(ship.ID, this._app.GameDatabase.InsertOrGetLimboFleetID(fleetInfo1.SystemID, this._app.LocalPlayer.ID)); } else if (ship.IsSDB() || ship.IsPlatform()) { this._app.GameDatabase.TransferShip(ship.ID, this._app.GameDatabase.InsertOrGetDefenseFleetInfo(fleetInfo1.SystemID, this._app.LocalPlayer.ID).ID); } else { this._app.GameDatabase.TransferShip(ship.ID, this._app.GameDatabase.InsertOrGetReserveFleetInfo(fleetInfo1.SystemID, this._app.LocalPlayer.ID).ID); } } foreach (FreighterInfo freighterInfo in list2) { ShipInfo shipInfo = this._app.GameDatabase.GetShipInfo(freighterInfo.ShipId, false); FleetInfo fleetInfo2 = this._app.GameDatabase.GetFleetInfo(shipInfo.FleetID); if (fleetInfo2 != null && fleetInfo2.IsReserveFleet && !fleetInfo2.IsLimboFleet) { this._app.GameDatabase.TransferShip(shipInfo.ID, this._app.GameDatabase.InsertOrGetLimboFleetID(freighterInfo.SystemId, freighterInfo.PlayerId)); } } this._app.GameDatabase.RemoveAdmiral(fleetInfo1.AdmiralID); this._app.GameDatabase.RemoveFleet(fleetInfo1.ID); this._RelocatefleetWidget.SetSyncedFleets(0); this.CaravanFleet = new int?(); } else { foreach (FreighterInfo freighterInfo in this._app.GameDatabase.GetFreighterInfosBuiltByPlayer(this._app.LocalPlayer.ID).Where <FreighterInfo>((Func <FreighterInfo, bool>)(x => x.IsPlayerBuilt)).ToList <FreighterInfo>()) { ShipInfo shipInfo = this._app.GameDatabase.GetShipInfo(freighterInfo.ShipId, false); FleetInfo fleetInfo = this._app.GameDatabase.GetFleetInfo(shipInfo.FleetID); if (fleetInfo != null && fleetInfo.IsReserveFleet && !fleetInfo.IsLimboFleet) { this._app.GameDatabase.TransferShip(shipInfo.ID, this._app.GameDatabase.InsertOrGetLimboFleetID(freighterInfo.SystemId, freighterInfo.PlayerId)); } } } this.SelectedCaravanSourceSystem = new int?(); }