Esempio n. 1
0
        /// <summary>
        /// Gets the description from the enum value, in this case the Race Code
        /// </summary>
        /// <param name="value">The enum value</param>
        /// <returns>The race code</returns>
        public static string GetRaceCode(this XivRace value)
        {
            var field     = value.GetType().GetField(value.ToString());
            var attribute = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);

            return(attribute.Length > 0 ? attribute[0].Description : value.ToString());
        }
Esempio n. 2
0
        private static string GetRaceCode(XivRace value)
        {
            FieldInfo field = value.GetType().GetField(value.ToString());

            DescriptionAttribute[] attribute = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
            return(attribute.Length > 0 ? attribute[0].Description : value.ToString());
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the Display Name of the Race from the Resource file in order to support localization
        /// </summary>
        /// <param name="value">The enum value</param>
        /// <returns>The localized display name of the race</returns>
        public static string GetDisplayName(this XivRace value)
        {
            var rm          = new ResourceManager(typeof(XivStrings));
            var displayName = rm.GetString(value.ToString());

            return(displayName);
        }