using System.Collections.Generic; using System.Linq; namespace ACE.Entity.Enum.Properties { /// /// Static selection of client enums that are [Ephemeral] /// These are properties that aren't saved to the shard. /// public static class EphemeralProperties { /// /// Method to return a list of enums by attribute type - in this case [Ephemeral] using generics to enhance code reuse. /// /// Enum to list by [Ephemeral] /// Type of the results private static HashSet GetValues() { var list = typeof(T).GetFields().Select(x => new { att = x.GetCustomAttributes(false).OfType().FirstOrDefault(), member = x }).Where(x => x.att != null && x.member.Name != "value__").Select(x => (T)x.member.GetValue(null)).ToList(); return new HashSet(list); } /// /// returns a list of values for PropertyInt that are [Ephemeral] /// PropertiesInt = GetValues(); /// /// returns a list of values for PropertyInt64 that are [Ephemeral] /// public static HashSet PropertiesInt64 = GetValues(); /// /// returns a list of values for PropertyBool that are [Ephemeral] /// public static HashSet PropertiesBool = GetValues(); /// /// returns a list of values for PropertyString that are [Ephemeral] /// public static HashSet PropertiesString = GetValues(); /// /// returns a list of values for PropertyFloat that are [Ephemeral] /// public static HashSet PropertiesDouble = GetValues(); /// /// returns a list of values for PropertyDataId that are [Ephemeral] /// public static HashSet PropertiesDataId = GetValues(); /// /// returns a list of values for PropertyInstanceId that are [Ephemeral] /// public static HashSet PropertiesInstanceId = GetValues(); /// /// returns a list of values for PositionType that are [Ephemeral] /// public static HashSet PositionTypes = GetValues(); } }