示例#1
0
        public Allegiance GetAllegianceFromCode(string code)
        {
            // TODO: Consider hashtable
            Allegiance alleg = Allegiances.Where(a => a.T5Code == code).FirstOrDefault();

            return(alleg ?? SecondSurvey.GetStockAllegianceFromCode(code));
        }
示例#2
0
        public Allegiance GetAllegiance(string code)
        {
            // TODO: Consider hashtable
            Allegiance alleg = Allegiances.Where(a => a.Code == code).FirstOrDefault();

            return(alleg != null ? alleg : Allegiance.GetStockAllegiance(code));
        }
示例#3
0
        // 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);
        }
示例#4
0
        internal string GetLabel(Sector sector)
        {
            if (!ShowLabel)
            {
                return(null);
            }
            if (!string.IsNullOrEmpty(Label))
            {
                return(Label);
            }
            Allegiance alleg = sector.GetAllegianceFromCode(Allegiance);

            return(alleg?.Name);
        }
示例#5
0
        /// <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);
        }
示例#6
0
        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);
        }