コード例 #1
0
        public string[] GetStatusGroupOutlets()
        {
            string failDID    = "";
            string successDID = "";
            SystemThreadPool <SnmpConfiger, bool> systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, bool>(this.snmpConfigs);

            systemThreadPool.GetResults(delegate(System.Collections.ICollection coll, object obj)
            {
                SnmpConfiger snmpConfiger = (SnmpConfiger)obj;
                SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger);
                try
                {
                    System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>();
                    for (int i = 1; i <= snmpConfiger.DevModelConfig.portNum; i++)
                    {
                        if (snmpConfiger.DevModelConfig.isOutletSwitchable(i - 1))
                        {
                            list.Add(i);
                        }
                    }
                    if (snmpExecutor.GetDeviceOutletsStatus(list) == null)
                    {
                        lock (DefaultSnmpExecutors.lockGroup)
                        {
                            failDID = failDID + snmpConfiger.DeviceID + ",";
                            goto IL_DA;
                        }
                    }
                    lock (DefaultSnmpExecutors.lockGroup)
                    {
                        successDID = successDID + snmpConfiger.DeviceID + ",";
                    }
                    IL_DA:;
                }
                catch (System.Exception)
                {
                    lock (DefaultSnmpExecutors.lockGroup)
                    {
                        failDID = failDID + snmpConfiger.DeviceID + ",";
                    }
                }
            });
            return(new string[]
            {
                failDID,
                successDID
            });
        }