using System.Collections.Generic; using System.Linq; namespace ACE.Entity.Enum.Properties { /// /// Static selection of client enums that are [SendOnLogin] /// These are properties that are sent in the Player Description Event /// public static class SendOnLoginProperties { /// /// Method to return a list of enums by attribute type - in this case [SendOnLogin] using generics to enhance code reuse. /// /// Enum to list by [SendOnLogin] /// 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 => (TResult)x.member.GetValue(null)).ToList(); return new HashSet(list); } /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesInt = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesInt64 = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesBool = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesString = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesDouble = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesDataId = GetValues(); /// /// returns a list of values for PropertyInt that are NOT [SendOnLogin] /// public static HashSet PropertiesInstanceId = GetValues(); } }