コード例 #1
0
        public string[] TurnOnGroupOutlets()
        {
            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);
                string text = "";
                bool flag   = false;
                try
                {
                    foreach (int current in snmpConfiger.GroupOutlets)
                    {
                        if (!string.IsNullOrEmpty(text))
                        {
                            text += ",";
                        }
                        text += current;
                    }
                    flag = snmpExecutor.TurnOnGroupOutlets(snmpConfiger.GroupOutlets);
                }
                catch (System.Exception)
                {
                }
                lock (DefaultSnmpExecutors.lockGroup)
                {
                    if (flag)
                    {
                        if (!string.IsNullOrEmpty(text))
                        {
                            object successDID;
                            if (!string.IsNullOrEmpty(successDID))
                            {
                                successDID += ";";
                            }
                            successDID = successDID;
                            successDID = string.Concat(new object[]
                            {
                                successDID,
                                snmpConfiger.DeviceID,
                                ":",
                                text
                            });
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(text))
                        {
                            object failDID;
                            if (!string.IsNullOrEmpty(failDID))
                            {
                                failDID += ";";
                            }
                            failDID = failDID;
                            failDID = string.Concat(new object[]
                            {
                                failDID,
                                snmpConfiger.DeviceID,
                                ":",
                                text
                            });
                        }
                    }
                }
            });
            return(new string[]
            {
                failDID,
                successDID
            });
        }