예제 #1
0
        public System.Collections.Generic.Dictionary <string, bool> SetDeviceThresholds(System.Collections.Generic.List <DevSnmpConfig> configs, DeviceThreshold deviceThreshold)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                list.Add(item);
            }
            System.Collections.Generic.List <string>             list2      = new AppSnmpExecutors(list).SetDevThresholds(deviceThreshold);
            System.Collections.Generic.Dictionary <string, bool> dictionary = new System.Collections.Generic.Dictionary <string, bool>();
            foreach (string current2 in list2)
            {
                string[] array = current2.Split(new char[]
                {
                    ':'
                });
                dictionary.Add(array[0], System.Convert.ToBoolean(array[1]));
            }
            return(dictionary);
        }
예제 #2
0
        public System.Collections.Generic.List <string> SetSensorThreshold(SensorThreshold SSThreshold)
        {
            System.Collections.Generic.List <string> list             = new System.Collections.Generic.List <string>();
            SystemThreadPool <SnmpConfiger, string>  systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, string>(this.snmpConfigs);

            return(systemThreadPool.GetResults(delegate(System.Collections.ICollection col, object obj)
            {
                SnmpConfiger snmpConfiger = (SnmpConfiger)obj;
                SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger);
                string arg = CultureTransfer.ToString(snmpConfiger.DeviceID);
                bool flag = false;
                try
                {
                    flag = snmpExecutor.SetSensorThreshold(SSThreshold);
                }
                catch (System.Exception)
                {
                }
                lock (col)
                {
                    ((System.Collections.Generic.List <string>)col).Add(arg + ":" + flag);
                }
            }));
        }