public static List <JToken> HistoricList(HistoryList history) // may create NULL entries if some material items not found { List <JToken> eventstosend = new List <JToken>(); HistoryEntry last = history.GetLast; if (last != null && last.EventTimeUTC > DateTime.UtcNow.AddDays(-30)) { foreach (var s in history.shipinformationlist.Ships) { ShipInformation si = s.Value; if (si.State == ShipInformation.ShipState.Owned && !ShipModuleData.IsSRVOrFighter(si.ShipFD)) { // loadout may be null if nothing in it. eventstosend.Add(InaraClass.setCommanderShipLoadout(si.ShipFD, si.ID, si.Modules.Values, DateTime.UtcNow)); eventstosend.Add(InaraClass.setCommanderShip(si.ShipFD, si.ID, DateTime.UtcNow, si.ShipUserName, si.ShipUserIdent, last.ShipInformation.ID == si.ID, null, si.HullValue, si.ModulesValue, si.Rebuy, si.StoredAtSystem, si.StoredAtStation)); } } eventstosend.Add(InaraClass.setCommanderStorageModules(last.StoredModules.StoredModules, last.EventTimeUTC)); } eventstosend = eventstosend.Where(x => x != null).ToList(); // remove any nulls return(eventstosend); }
public void LoadGame(int id, string ship, string shipfd, string name, string ident, double fuellevel, double fueltotal) // LoadGame.. { string sid = Key(shipfd, id); ShipInformation sm = EnsureShip(sid); // this either gets current ship or makes a new one. Ships[sid] = sm = sm.SetShipDetails(ship, shipfd, name, ident, fuellevel, fueltotal); // this makes a shallow copy if any data has changed.. //System.Diagnostics.Debug.WriteLine("Load Game " + sm.ID + " " + sm.Ship); if (!ShipModuleData.IsSRVOrFighter(shipfd)) { currentid = sid; } }
private void UpdateComboBox(HistoryList hl) { ShipInformationList shm = hl.shipinformationlist; string cursel = comboBoxShips.Text; comboBoxShips.Items.Clear(); comboBoxShips.Items.Add(travelhistorytext); comboBoxShips.Items.Add(storedmoduletext); comboBoxShips.Items.Add(allmodulestext); var ownedships = (from x1 in shm.Ships where x1.Value.State == ShipInformation.ShipState.Owned && !ShipModuleData.IsSRVOrFighter(x1.Value.ShipFD) select x1.Value); var notownedships = (from x1 in shm.Ships where x1.Value.State != ShipInformation.ShipState.Owned && !ShipModuleData.IsSRVOrFighter(x1.Value.ShipFD) select x1.Value); var fightersrvs = (from x1 in shm.Ships where ShipModuleData.IsSRVOrFighter(x1.Value.ShipFD) select x1.Value); var now = (from x1 in ownedships where x1.StoredAtSystem == null select x1.ShipNameIdentType).ToList(); comboBoxShips.Items.AddRange(now); var stored = (from x1 in ownedships where x1.StoredAtSystem != null select x1.ShipNameIdentType).ToList(); comboBoxShips.Items.AddRange(stored); comboBoxShips.Items.AddRange(notownedships.Select(x => x.ShipNameIdentType).ToList()); comboBoxShips.Items.AddRange(fightersrvs.Select(x => x.ShipNameIdentType).ToList()); if (cursel == "") { cursel = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbShipSave, ""); } if (cursel == "" || !comboBoxShips.Items.Contains(cursel)) { cursel = travelhistorytext; } comboBoxShips.Enabled = false; comboBoxShips.SelectedItem = cursel; comboBoxShips.Enabled = true; }
public static List <JToken> NewEntryList(HistoryList history, HistoryEntry he) // may create NULL entries if some material items not found { List <JToken> eventstosend = new List <JToken>(); switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.ShipyardBuy: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardBuy; if (je.StoreOldShipFD != null && je.StoreOldShipId.HasValue) { eventstosend.Add(InaraClass.setCommanderShip(je.StoreOldShipFD, je.StoreOldShipId.Value, he.EventTimeUTC, curship: false, starsystemName: he.System.Name, stationName: he.WhereAmI)); } if (je.SellOldShipFD != null && je.SellOldShipId.HasValue) { eventstosend.Add(InaraClass.delCommanderShip(je.SellOldShipFD, je.SellOldShipId.Value, he.EventTimeUTC)); } eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; break; } case JournalTypeEnum.ShipyardNew: // into a new ship // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardNew; eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, curship: true, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.ShipyardSell: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardSell; eventstosend.Add(InaraClass.delCommanderShip(je.ShipTypeFD, je.SellShipId, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; break; } case JournalTypeEnum.ShipyardSwap: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardSwap; eventstosend.Add(InaraClass.setCommanderShip(je.StoreOldShipFD, je.StoreShipId.Value, he.EventTimeUTC, curship: false, starsystemName: he.System.Name, stationName: he.WhereAmI)); eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, curship: true, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.ShipyardTransfer: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardTransfer; eventstosend.Add(InaraClass.setCommanderShipTransfer(je.ShipTypeFD, je.ShipId, he.System.Name, he.WhereAmI, he.MarketID, je.nTransferTime ?? 0, he.EventTimeUTC)); break; } case JournalTypeEnum.Loadout: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalLoadout; var si = he.ShipInformation; if (je.ShipFD.HasChars() && !ShipModuleData.IsSRVOrFighter(je.ShipFD)) // if it has an FDname (defensive) and is not SRV/Fighter { if (je.ShipId == si.ID) { eventstosend.Add(InaraClass.setCommanderShipLoadout(je.ShipFD, je.ShipId, si.Modules.Values, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, je.ShipName, je.ShipIdent, true, null, je.HullValue, je.ModulesValue, je.Rebuy)); } else { System.Diagnostics.Debug.WriteLine("ERROR IN EDD Inara system:Current ship does not match loadout"); } } break; } case JournalTypeEnum.StoredModules: // VERIFIED 18/5/2018 from historic upload test { eventstosend.Add(InaraClass.setCommanderStorageModules(he.StoredModules.StoredModules, he.EventTimeUTC)); break; } case JournalTypeEnum.SetUserShipName: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalSetUserShipName; eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipID, he.EventTimeUTC, curship: true, username: je.ShipName, userid: je.ShipIdent, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.Docked: // VERIFIED 18/5/2018 from historic upload test { var je = he.journalEntry as JournalDocked; eventstosend.Add(InaraClass.addCommanderTravelDock(he.ShipInformation.ShipFD, he.ShipInformation.ID, je.StarSystem, je.StationName, je.MarketID, he.EventTimeUTC)); break; } case JournalTypeEnum.FSDJump: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalFSDJump; eventstosend.Add(InaraClass.addCommanderTravelFSDJump(he.ShipInformation.ShipFD, he.ShipInformation.ID, je.StarSystem, je.JumpDist, he.EventTimeUTC)); break; } case JournalTypeEnum.Location: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalLocation; eventstosend.Add(InaraClass.setCommanderTravelLocation(je.StarSystem, je.Docked ? je.StationName : null, je.Docked ? je.MarketID : null, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionAccepted: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionAccepted; eventstosend.Add(InaraClass.addCommanderMission(je, he.System.Name, he.WhereAmI)); break; } case JournalTypeEnum.MissionAbandoned: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionAbandoned; eventstosend.Add(InaraClass.setCommanderMissionAbandoned(je.MissionId, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionFailed: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionFailed; eventstosend.Add(InaraClass.setCommanderMissionFailed(je.MissionId, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionCompleted: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionCompleted; eventstosend.Add(InaraClass.setCommanderMissionCompleted(je)); break; } case JournalTypeEnum.Progress: // progress comes after rank. No need for rank. VERIFIED 16/5/18 { JournalRank rank = history.GetLastJournalEntry <JournalRank>(x => x.EntryType == JournalTypeEnum.Rank); JournalProgress progress = history.GetLastJournalEntry <JournalProgress>(x => x.EntryType == JournalTypeEnum.Progress); if (rank != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("combat", (int)rank.Combat, progress?.Combat ?? -1, rank.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("trade", (int)rank.Trade, progress?.Trade ?? -1, rank.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("explore", (int)rank.Explore, progress?.Explore ?? -1, rank.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("empire", (int)rank.Empire, progress?.Empire ?? -1, rank.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("federation", (int)rank.Federation, progress?.Federation ?? -1, rank.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("cqc", (int)rank.CQC, progress?.CQC ?? -1, rank.EventTimeUTC)); } break; } case JournalTypeEnum.Promotion: // promotion { var promotion = he.journalEntry as JournalPromotion; if (promotion.Combat != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("combat", (int)promotion.Combat, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Trade != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("trade", (int)promotion.Trade, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Explore != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("explore", (int)promotion.Explore, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Empire != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("empire", (int)promotion.Empire, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Federation != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("federation", (int)promotion.Federation, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.CQC != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("cqc", (int)promotion.CQC, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } break; } case JournalTypeEnum.Reputation: // VERIFIED 16/5/18 { var reputation = he.journalEntry as JournalReputation; eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("federation", reputation.Federation.HasValue ? reputation.Federation.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("empire", reputation.Empire.HasValue ? reputation.Empire.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("independent", reputation.Independent.HasValue ? reputation.Independent.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("alliance", reputation.Alliance.HasValue ? reputation.Alliance.Value : 0, reputation.EventTimeUTC)); break; } case JournalTypeEnum.Powerplay: // VERIFIED 16/5/18 { JournalPowerplay power = he.journalEntry as JournalPowerplay; eventstosend.Add(InaraClass.setCommanderRankPower(power.Power, power.Rank, power.EventTimeUTC)); break; } case JournalTypeEnum.EngineerProgress: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerProgress; foreach (var x in je.Engineers) { eventstosend.Add(InaraClass.setCommanderRankEngineer(x.Engineer, x.Progress, x.Rank, he.EventTimeUTC)); } break; } case JournalTypeEnum.Died: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalDied; string[] killers = je.Killers != null?je.Killers.Select(x => x.Name).ToArray() : null; eventstosend.Add(InaraClass.addCommanderCombatDeath(he.System.Name, killers, he.EventTimeUTC)); break; } case JournalTypeEnum.Interdicted: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalInterdicted; eventstosend.Add(InaraClass.addCommanderCombatInterdicted(he.System.Name, je.Interdictor, je.IsPlayer, je.Submitted, he.EventTimeUTC)); break; } case JournalTypeEnum.Interdiction: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalInterdiction; eventstosend.Add(InaraClass.addCommanderCombatInterdiction(he.System.Name, je.Interdicted.HasChars() ? je.Interdicted : je.Faction, je.IsPlayer, je.Success, he.EventTimeUTC)); break; } case JournalTypeEnum.EscapeInterdiction: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEscapeInterdiction; eventstosend.Add(InaraClass.addCommanderCombatInterdictionEscape(he.System.Name, je.Interdictor, je.IsPlayer, he.EventTimeUTC)); break; } case JournalTypeEnum.PVPKill: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalPVPKill; eventstosend.Add(InaraClass.addCommanderCombatKill(he.System.Name, je.Victim, he.EventTimeUTC)); break; } case JournalTypeEnum.CargoDepot: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCargoDepot; if (je.CargoType.HasChars() && je.Count > 0) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.CargoType, he.EventTimeUTC)); } break; } case JournalTypeEnum.CollectCargo: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCollectCargo; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.EjectCargo: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEjectCargo; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.EngineerContribution: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerContribution; if (je.Commodity.HasChars()) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Commodity, he.EventTimeUTC)); } if (je.Material.HasChars()) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Material, he.EventTimeUTC)); } break; } case JournalTypeEnum.MarketBuy: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMarketBuy; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.MarketSell: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMarketSell; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.Cargo: //VERIFIED 16/5/18 { List <MaterialCommodities> commod = he.MaterialCommodity.Sort(true); // all commodities var listc = commod.Where(x => x.Count > 0).Select(x => new Tuple <string, int>(x.Details.FDName, x.Count)); eventstosend.Add(InaraClass.setCommanderInventoryCargo(listc, he.EventTimeUTC)); break; } case JournalTypeEnum.Materials: //VERIFIED 16/5/18 { List <MaterialCommodities> mat = he.MaterialCommodity.Sort(false); // all materials var listm = mat.Where(x => x.Count > 0).Select(x => new Tuple <string, int>(x.Details.FDName, x.Count)); eventstosend.Add(InaraClass.setCommanderInventoryMaterials(listm, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialCollected: { var je = he.journalEntry as JournalMaterialCollected; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Name, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialDiscarded: { var je = he.journalEntry as JournalMaterialDiscarded; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Name, he.EventTimeUTC)); break; } case JournalTypeEnum.MiningRefined: { var je = he.journalEntry as JournalMiningRefined; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialTrade: // one out, one in.. //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMaterialTrade; if (je.Paid != null) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Paid.Material, he.EventTimeUTC)); } if (je.Received != null) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Received.Material, he.EventTimeUTC)); } break; } case JournalTypeEnum.EngineerCraft: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerCraft; if (je.Ingredients != null) { foreach (KeyValuePair <string, int> k in je.Ingredients) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, k.Key, he.EventTimeUTC)); } } break; } case JournalTypeEnum.Synthesis: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalSynthesis; if (je.Materials != null) { foreach (KeyValuePair <string, int> k in je.Materials) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, k.Key, he.EventTimeUTC)); } } break; } case JournalTypeEnum.Statistics: //VERIFIED 16/5/18 { JournalStatistics stats = he.journalEntry as JournalStatistics; eventstosend.Add(InaraClass.setCommanderGameStatistics(stats.Json, stats.EventTimeUTC)); break; } case JournalTypeEnum.CommunityGoal: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCommunityGoal; foreach (var c in je.CommunityGoals) { eventstosend.Add(InaraClass.setCommunityGoal(c, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommandersCommunityGoalProgress(c, he.EventTimeUTC)); } break; } case JournalTypeEnum.Friends: { var je = he.journalEntry as JournalFriends; if (je.StatusList != null) { for (int i = 0; i < je.StatusList.Count; i++) { string s = je.StatusList[i].ToLower(); if (s == "online" || s == "added") { eventstosend.Add(InaraClass.addCommanderFriend(je.NameList[i], he.EventTimeUTC)); } else if (s == "lost") { eventstosend.Add(InaraClass.delCommanderFriend(je.NameList[i], he.EventTimeUTC)); } } } else { string s = je.Status.ToLower(); if (s == "online" || s == "added") { eventstosend.Add(InaraClass.addCommanderFriend(je.Name, he.EventTimeUTC)); } else if (s == "lost") { eventstosend.Add(InaraClass.delCommanderFriend(je.Name, he.EventTimeUTC)); } } break; } } if (Math.Abs(CmdrCredits - he.Credits) > 500000) { eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; } eventstosend = eventstosend.Where(x => x != null).ToList(); // remove any nulls return(eventstosend); }
private void Display() // allow redisplay of last data { DataGridViewColumn sortcolprev = dataGridViewModules.SortedColumn != null ? dataGridViewModules.SortedColumn : dataGridViewModules.Columns[0]; SortOrder sortorderprev = dataGridViewModules.SortedColumn != null ? dataGridViewModules.SortOrder : SortOrder.Ascending; int firstline = dataGridViewModules.FirstDisplayedScrollingRowIndex; dataGridViewModules.Rows.Clear(); dataViewScrollerPanel.SuspendLayout(); last_si = null; // no ship info dataGridViewModules.Columns[2].HeaderText = "Slot".T(EDTx.UserControlModules_SlotCol); dataGridViewModules.Columns[3].HeaderText = "Info".T(EDTx.UserControlModules_ItemInfo); dataGridViewModules.Columns[6].HeaderText = "Value".T(EDTx.UserControlModules_Value); if (comboBoxShips.Text == storedmoduletext) { labelVehicle.Visible = buttonExtCoriolis.Visible = buttonExtEDShipyard.Visible = buttonExtConfigure.Visible = false; if (last_he != null && last_he.StoredModules != null) { ModulesInStore mi = last_he.StoredModules; labelVehicle.Text = ""; foreach (ModulesInStore.StoredModule sm in mi.StoredModules) { object[] rowobj = { sm.Name_Localised.Alt(sm.Name), sm.Name, sm.StarSystem.Alt("In Transit".T(EDTx.UserControlModules_InTransit)), sm.TransferTimeString, sm.Mass > 0 ? (sm.Mass.ToString() + "t") : "", sm.EngineerModifications.Alt(""), sm.TransferCost > 0 ? sm.TransferCost.ToString("N0") : "", "" }; dataGridViewModules.Rows.Add(rowobj); } dataGridViewModules.Columns[2].HeaderText = "System".T(EDTx.UserControlModules_System); dataGridViewModules.Columns[3].HeaderText = "Tx Time".T(EDTx.UserControlModules_TxTime); dataGridViewModules.Columns[6].HeaderText = "Cost".T(EDTx.UserControlModules_Cost); } } else if (comboBoxShips.Text == allmodulestext) { labelVehicle.Visible = buttonExtCoriolis.Visible = buttonExtEDShipyard.Visible = buttonExtConfigure.Visible = false; ShipInformationList shm = discoveryform.history.shipinformationlist; var ownedships = (from x1 in shm.Ships where x1.Value.State == ShipInformation.ShipState.Owned && !ShipModuleData.IsSRVOrFighter(x1.Value.ShipFD) select x1.Value); foreach (var si in ownedships) { foreach (string key in si.Modules.Keys) { EliteDangerousCore.ShipModule sm = si.Modules[key]; AddModuleLine(sm, si); } } if (last_he != null && last_he.StoredModules != null) { ModulesInStore mi = last_he.StoredModules; labelVehicle.Text = ""; foreach (ModulesInStore.StoredModule sm in mi.StoredModules) { string info = sm.StarSystem.Alt("In Transit".T(EDTx.UserControlModules_InTransit)); info = info.AppendPrePad(sm.TransferTimeString, ":"); object[] rowobj = { sm.Name_Localised.Alt(sm.Name), sm.Name, "Stored".Tx(EDTx.UserControlModules_Stored), info, sm.Mass > 0 ? (sm.Mass.ToString() + "t") : "", sm.EngineerModifications.Alt(""), sm.TransferCost > 0 ? sm.TransferCost.ToString("N0") : "", "" }; dataGridViewModules.Rows.Add(rowobj); } } } else if (comboBoxShips.Text == travelhistorytext || comboBoxShips.Text.Length == 0) // second is due to the order History gets called vs this on start { if (last_he != null && last_he.ShipInformation != null) { DisplayShip(last_he.ShipInformation); } } else { ShipInformation si = discoveryform.history.shipinformationlist.GetShipByNameIdentType(comboBoxShips.Text); if (si != null) { DisplayShip(si); } } dataViewScrollerPanel.ResumeLayout(); dataGridViewModules.Sort(sortcolprev, (sortorderprev == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending); dataGridViewModules.Columns[sortcolprev.Index].HeaderCell.SortGlyphDirection = sortorderprev; if (firstline >= 0 && firstline < dataGridViewModules.RowCount) { dataGridViewModules.SafeFirstDisplayedScrollingRowIndex(firstline); } }