public Allegiance GetAllegianceFromCode(string code) { // TODO: Consider hashtable Allegiance alleg = Allegiances.Where(a => a.T5Code == code).FirstOrDefault(); return(alleg ?? SecondSurvey.GetStockAllegianceFromCode(code)); }
public Allegiance GetAllegiance(string code) { // TODO: Consider hashtable Allegiance alleg = Allegiances.Where(a => a.Code == code).FirstOrDefault(); return(alleg != null ? alleg : Allegiance.GetStockAllegiance(code)); }
// TODO: This discounts the Sector's allegiance/base definitions, if any. public static string AllegianceCodeToBaseAllegianceCode(string code) { Allegiance alleg = GetStockAllegianceFromCode(code); if (alleg == null) { return(code); } if (string.IsNullOrEmpty(alleg.Base)) { return(code); } return(alleg.Base); }
internal string GetLabel(Sector sector) { if (!ShowLabel) { return(null); } if (!string.IsNullOrEmpty(Label)) { return(Label); } Allegiance alleg = sector.GetAllegianceFromCode(Allegiance); return(alleg?.Name); }
/// <summary> /// Map allegiances like "Sy" for "Sylean Federation" worlds to "Im" /// </summary> /// <param name="code">The allegiance code to map, e.g. "Sy"</param> /// <returns>The base allegiance code, e.g. "Im", or the original code if none.</returns> public string GetBaseAllegianceCode(string code) { if (m_allegiances == null) { return(code); } Allegiance alleg = m_allegiances.Where(a => a.Code != null && a.Code == code).FirstOrDefault(); if (alleg != null && !String.IsNullOrEmpty(alleg.Base)) { return(alleg.Base); } return(code); }
public string GetLabel(Sector sector) { if (!ShowLabel) { return(null); } if (!string.IsNullOrEmpty(Label)) { return(Label); } Allegiance alleg = sector.GetAllegianceFromCode(Allegiance); if (alleg == null) { return(null); } return(alleg.Name); }