예제 #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);
        }