public static int GetFrequencyInMinutes(this ECollectorType c) { int frequency = 0; Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(DefaultCollectionFrequencyAttribute), false); if (attrs != null && attrs.Length > 0) { frequency = (attrs[0] as DefaultCollectionFrequencyAttribute).FrequencyInMinutes; } } return(frequency); }
public static bool GetSkipConfiguration(this ECollectorType c) { bool skip_configuration = false; Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(SkipConfigurationAttribute), false); if (attrs != null && attrs.Length > 0) { skip_configuration = (attrs[0] as SkipConfigurationAttribute).SkipConfiguration; } } return(skip_configuration); }
public static List <EDeviceType> GetDevices(this ECollectorType c) { List <EDeviceType> types = new List <EDeviceType>(); Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(DevicesAttribute), false); if (attrs != null) { foreach (object o in attrs) { DevicesAttribute attr = o as DevicesAttribute; types.AddRange(attr.Devices); } } } return(types); }