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); } })); }
public string[] RestoreThresholds2Device() { string failMAC = ""; string successDID = ""; string misMAC = ""; 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 { bool flag = false; int num = snmpExecutor.CheckDeviceMac(snmpConfiger.DeviceMac); if (num >= 0) { flag = snmpExecutor.UpdateDeviceName(snmpConfiger.RestoreThresholds.DeviceName); } else { if (num == -1) { lock (DefaultSnmpExecutors.lockRestore) { misMAC = misMAC + snmpConfiger.DeviceMac + ","; } } } if (flag) { DevicePOPSettings devicePOPSettings = new DevicePOPSettings(); devicePOPSettings.copyPOPSetings(snmpConfiger.RestoreThresholds.DeviceThreshold); snmpExecutor.SetDevicePOPSettings(devicePOPSettings); snmpExecutor.SetDeviceThreshold(snmpConfiger.RestoreThresholds.DeviceThreshold); for (int i = 0; i < snmpConfiger.RestoreThresholds.SensorThreshold.Count; i++) { snmpExecutor.SetSensorThreshold(snmpConfiger.RestoreThresholds.SensorThreshold[i + 1]); } for (int j = 0; j < snmpConfiger.RestoreThresholds.BankThreshold.Count; j++) { snmpExecutor.SetBankThreshold(snmpConfiger.RestoreThresholds.BankThreshold[j + 1]); } for (int k = 0; k < snmpConfiger.RestoreThresholds.OutletThreshold.Count; k++) { snmpExecutor.SetOutletThreshold(snmpConfiger.RestoreThresholds.OutletThreshold[k + 1]); } for (int l = 0; l < snmpConfiger.RestoreThresholds.LineThreshold.Count; l++) { snmpExecutor.SetLineThreshold(snmpConfiger.RestoreThresholds.LineThreshold[l + 1]); } } if (!flag) { lock (DefaultSnmpExecutors.lockRestore) { failMAC = failMAC + snmpConfiger.DeviceMac + ","; goto IL_217; } } lock (DefaultSnmpExecutors.lockRestore) { successDID = successDID + snmpConfiger.DeviceID + ","; } IL_217:; } catch (System.Exception ex) { lock (DefaultSnmpExecutors.lockRestore) { failMAC = failMAC + snmpConfiger.DeviceMac + ","; } DebugCenter instance = DebugCenter.GetInstance(); instance.appendToFile("Failed to restore config to device: " + snmpConfiger.RestoreThresholds.DeviceName + ", " + ex.Message); } }); return(new string[] { failMAC, successDID, misMAC }); }