Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }