public System.Collections.Generic.List <PropertiesMessage> GetProperties_ALL() { System.DateTime createTime = System.DateTime.Now; SystemThreadPool <SnmpConfiger, PropertiesMessage> systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, PropertiesMessage>(this.snmpConfigs); return(systemThreadPool.GetResults(delegate(System.Collections.ICollection col, object obj) { SnmpConfiger snmpConfiger = (SnmpConfiger)obj; SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger); PropertiesMessage propertiesMessage = null; try { propertiesMessage = snmpExecutor.GetProperties_ALL(); propertiesMessage.CreateTime = createTime; propertiesMessage.IpAddress = snmpConfiger.SnmpConfig.AgentIp; propertiesMessage.PortNums = snmpConfiger.PortNumbers; propertiesMessage.PerPortReading = snmpConfiger.PerPortReading; propertiesMessage.Switchable = snmpConfiger.Switchable; propertiesMessage.SensorNums = snmpConfiger.SensorNumber; } catch (System.Exception) { } if (propertiesMessage != null) { lock (col) { ((System.Collections.Generic.List <PropertiesMessage>)col).Add(propertiesMessage); } } })); }
private void handleTheResult(FirmwareUpgrade.Upgrading upgrading, int status) { switch (status) { case 0: upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, ""); return; case 2: upgrading(UpgradeStatus.Upgrading, this.m_devID, ""); return; case 3: upgrading(UpgradeStatus.NoNeedToUpgrade, this.m_devID, ""); return; case 4: upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, ""); return; case 5: upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, ""); return; } string text = string.Empty; DefaultSnmpExecutor defaultSnmpExecutor = null; try { DeviceInfo deviceByID = DeviceOperation.getDeviceByID(this.m_devID); DevSnmpConfig sNMPpara = commUtil.getSNMPpara(deviceByID); SnmpConfig snmpConfig = DevAccessCfg.GetInstance().getSnmpConfig(sNMPpara); defaultSnmpExecutor = new DefaultSnmpExecutor(new SnmpConfiger(snmpConfig, 1)); } catch (System.Exception) { } int num = 0; while (num++ < 20) { try { PropertiesMessage properties_ATEN = defaultSnmpExecutor.GetProperties_ATEN(); text = properties_ATEN.FirwWareVersion; break; } catch (System.Exception) { System.Threading.Thread.Sleep(1000); } } if (text.Equals(string.Empty)) { upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, ""); return; } upgrading(UpgradeStatus.UpgradeSucceed, this.m_devID, text); }
public static PropertiesMessage GetApcPDUPropertiesMessage(System.Collections.Generic.Dictionary <string, string> variables) { if (variables == null || variables.Count < 1) { return(null); } PropertiesMessage propertiesMessage = new PropertiesMessage(); System.Collections.Generic.IEnumerator <string> enumerator = variables.Keys.GetEnumerator(); while (enumerator.MoveNext()) { string current = enumerator.Current; string text = variables[current]; if (current.StartsWith(ApcPDUBaseMib.DeviceName)) { if ("\0".Equals(text) || string.IsNullOrEmpty(text)) { text = string.Empty; } propertiesMessage.DeviceName = text; } else { if (current.StartsWith(ApcPDUBaseMib.FWversion)) { text = text.Replace("v", ""); text = text.Replace("V", ""); propertiesMessage.FirwWareVersion = text; } else { if (current.StartsWith(ApcPDUBaseMib.Mac)) { propertiesMessage.MacAddress = text.Replace(" ", ":").Replace("-", ":"); } else { if (!current.StartsWith(ApcPDUBaseMib.ModelName)) { return(null); } if ("\0".Equals(text) || string.IsNullOrEmpty(text)) { return(null); } propertiesMessage.ModelName = text; } } } } propertiesMessage.DashboardRackname = ""; propertiesMessage.CreateTime = System.DateTime.Now; return(propertiesMessage); }
private void DiscoveMethod() { try { string[] array = this.m_strip.Split(new char[] { '.' }); System.Collections.Generic.List <PropertiesMessage> list = null; if (array.Length == 4) { if (this.m_scanCompany == 1) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_ATEN(this.m_strip, this.m_strip); } else { if (this.m_scanCompany == 2) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_EATON(this.m_strip, this.m_strip); } else { if (this.m_scanCompany == 4) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_APC(this.m_strip, this.m_strip); } } } } else { if (array.Length == 3) { if (this.m_scanCompany == 1) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_ATEN(this.m_strip + ".1", this.m_strip + ".255"); } else { if (this.m_scanCompany == 2) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_EATON(this.m_strip + ".1", this.m_strip + ".255"); } else { if (this.m_scanCompany == 4) { list = new DevDiscoverAPI(this.m_SNMPPara).Scan_APC(this.m_strip + ".1", this.m_strip + ".255"); } } } } } if (list != null && list.Count > 0) { using (System.Collections.Generic.List <PropertiesMessage> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { PropertiesMessage current = enumerator.Current; string deviceName = current.DeviceName; string ipAddress = current.IpAddress; string macAddress = current.MacAddress; string firwWareVersion = current.FirwWareVersion; string modelName = current.ModelName; if (DeviceOperation.getDeviceByMac(macAddress) == null) { string text = current.DashboardRackname.Equals("\0") ? "" : current.DashboardRackname; if (!DevAccessCfg.GetInstance().getDeviceModelConfig(modelName, firwWareVersion).modelName.Equals(string.Empty)) { string[] item = new string[] { deviceName, macAddress, ipAddress, modelName, text, firwWareVersion }; this.deviceList.Add(item); } } } goto IL_268; } } this.deviceList.Count <string[]>(); IL_268 :; } catch (System.Exception) { } }