private static System.Collections.Generic.Dictionary <int, BankValueEntry> GetBankValue(System.Collections.Generic.Dictionary <string, string> result) { System.Collections.Generic.Dictionary <int, BankValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, BankValueEntry>(); System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator(); int num = 0; while (enumerator.MoveNext()) { string current = enumerator.Current; string text = result[current]; if ("\0".Equals(text)) { text = System.Convert.ToString(-1000); } else { if (string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-500); } } int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (!dictionary.ContainsKey(num2)) { BankValueEntry value = new BankValueEntry(num2); dictionary.Add(num2, value); } if (num != num2) { new BankValueMib(num2); num = num2; } BankValueEntry bankValueEntry = dictionary[num2]; EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(num2); EatonGroupVoltageMib_M2 eatonGroupVoltageMib_M = new EatonGroupVoltageMib_M2(num2); EatonGroupPowerMib_M2 eatonGroupPowerMib_M = new EatonGroupPowerMib_M2(num2); if (current.StartsWith(eatonGroupCurrentMib_M.CurrentValue)) { bankValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f); } else { if (current.StartsWith(eatonGroupVoltageMib_M.VoltageValue)) { bankValueEntry.Voltage = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f); } else { if (current.StartsWith(eatonGroupPowerMib_M.PowerValue)) { bankValueEntry.Power = text; } } } } return(dictionary); }
private static System.Collections.Generic.Dictionary <int, BankThreshold> GetBankThreshold(System.Collections.Generic.Dictionary <string, string> result) { System.Collections.Generic.Dictionary <int, BankThreshold> dictionary = new System.Collections.Generic.Dictionary <int, BankThreshold>(); System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator(); EatonGroupEntryMib_M2 eatonGroupEntryMib_M = null; EatonGroupVoltageMib_M2 eatonGroupVoltageMib_M = null; EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = null; int num = 0; while (enumerator.MoveNext()) { string current = enumerator.Current; string text = result[current]; if ("\0".Equals(text)) { text = System.Convert.ToString(-1000000); } else { if (text == null || string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-500000); } } int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (!dictionary.ContainsKey(num2)) { BankThreshold value = new BankThreshold(num2); dictionary.Add(num2, value); } if (num != num2) { eatonGroupEntryMib_M = new EatonGroupEntryMib_M2(num2); eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(num2); eatonGroupVoltageMib_M = new EatonGroupVoltageMib_M2(num2); num = num2; } BankThreshold bankThreshold = dictionary[num2]; if (current.StartsWith(eatonGroupEntryMib_M.GroupName)) { bankThreshold.BankName = (text.Equals(System.Convert.ToString(-1000000)) ? string.Empty : text); } else { if (current.StartsWith(eatonGroupCurrentMib_M.MinCurrentMt)) { bankThreshold.MinCurrentMt = (float)System.Convert.ToInt32(text) / 1000f; } else { if (current.StartsWith(eatonGroupCurrentMib_M.MaxCurrentMT)) { bankThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text) / 1000f; } else { if (current.StartsWith(eatonGroupVoltageMib_M.MinVoltageMt)) { bankThreshold.MinVoltageMT = (float)System.Convert.ToInt32(text) / 1000f; } else { if (!current.StartsWith(eatonGroupVoltageMib_M.MaxVoltageMT)) { return(new System.Collections.Generic.Dictionary <int, BankThreshold>()); } bankThreshold.MaxVoltageMT = (float)System.Convert.ToInt32(text) / 1000f; } } } } if (bankThreshold.MinCurrentMt == -500f) { bankThreshold.MinCurrentMt = -300f; } if (bankThreshold.MinPowerMT == -500f) { bankThreshold.MinPowerMT = -300f; } } return(dictionary); }