protected override string Prefetch(long id) { string name = null; if (id < int.MaxValue && id > int.MinValue && id != 0) { int intId = (int)id; // Check NPC corporations var npcCorp = StaticGeography.GetCorporationByID(intId); if (npcCorp != null) { name = npcCorp.Name; } else { // Check NPC factions var npcFaction = StaticGeography.GetFactionByID(intId); if (npcFaction != null) { name = npcFaction.Name; } } } return(name); }
protected override string Prefetch(long id) { string name = null; if (id == 0L) { // Empty IDs are always "unknown" name = EveMonConstants.UnknownText; } else if (id < int.MaxValue && id > int.MinValue) { int intId = (int)id; // Check NPC corporations var npcCorp = StaticGeography.GetCorporationByID(intId); if (npcCorp != null) { name = npcCorp.Name; } else { // Check NPC factions var npcFaction = StaticGeography.GetFactionByID(intId); if (npcFaction != null) { name = npcFaction.Name; } } } // Try filling with a current character identity or corporation/alliance if (string.IsNullOrEmpty(name)) { foreach (var character in EveMonClient.Characters) { string corpName = character.CorporationName, allianceName = character. AllianceName; if (character.CharacterID == id) { name = character.Name; break; } if (character.CorporationID == id && !corpName.IsEmptyOrUnknown()) { name = corpName; break; } if (character.AllianceID == id && !allianceName.IsEmptyOrUnknown()) { name = allianceName; break; } } } return(name); }