public static Range GetDriveTemperatureRange(string model, string rangeName) { DrivelistEntry drivelistEntry = Drivelist.GetInstance().Match(model); if (drivelistEntry != null && ItemProfiles.GetInstance() != null) { return(ItemProfiles.GetInstance().GetRange(drivelistEntry.Profile, rangeName)); } return(null); }
public static string Dump() { string str = ""; string text = "WDC WD2009FYPX-09AAMB0"; Range driveTemperatureRange = SystemConfig.GetDriveTemperatureRange(text, "Warning"); if (driveTemperatureRange != null) { str += string.Format("Model={0} Warning Min={1} Max={2}", text, driveTemperatureRange.Min, driveTemperatureRange.Max); } else { str += string.Format("Cannot find drive model: {0}", text); } str += Environment.NewLine; str += Drivelist.GetInstance().Dump(); str += DriveMap.GetInstance().Dump(); str += EthernetPortProfiles.GetInstance().Dump(); str += CpuList.GetInstance().Dump(); str += SystemProfiles.GetInstance().Dump(); str += ItemProfiles.GetInstance().Dump(); return(str + ThermalProfiles.GetInstance().Dump()); }
public void Load(XmlNodeList nodes) { foreach (object obj in nodes) { XmlNode xmlNode = (XmlNode)obj; if (xmlNode.NodeType != XmlNodeType.Comment) { ItemProfile itemProfile = new ItemProfile(); itemProfile.Name = ItemProfiles.GetValue(xmlNode, "Name"); string value = ItemProfiles.GetValue(xmlNode, "Default"); if (string.IsNullOrEmpty(value)) { itemProfile.DefaultProfile = false; } else { itemProfile.DefaultProfile = true; ItemProfiles.defaultItemProfile = itemProfile.Name; } itemProfile.RangeProfile = new Dictionary <string, Range>(); XmlNode xmlNode2 = xmlNode["RangeProfile"]; if (xmlNode2 != null) { XmlNodeList childNodes = xmlNode2.ChildNodes; foreach (object obj2 in childNodes) { XmlNode xmlNode3 = (XmlNode)obj2; if (xmlNode3.NodeType != XmlNodeType.Comment) { Range range = new Range(); range.Name = xmlNode3.Attributes["Name"].Value; range.Min = int.Parse(xmlNode3.Attributes["Min"].Value); range.Max = int.Parse(xmlNode3.Attributes["Max"].Value); try { itemProfile.RangeProfile.Add(range.Name, range); } catch (Exception) { this.SetError(string.Format("{0}: duplicate Range Name={1} Value={2} Delta={3}", new object[] { itemProfile.Name, range.Name, range.Min, range.Max })); } } } } itemProfile.ThrottleProfile = new Dictionary <string, FanThrottle>(); xmlNode2 = xmlNode["FanThrottleProfile"]; if (xmlNode2 != null) { XmlNodeList childNodes2 = xmlNode2.ChildNodes; foreach (object obj3 in childNodes2) { XmlNode xmlNode4 = (XmlNode)obj3; if (xmlNode4.NodeType != XmlNodeType.Comment) { FanThrottle fanThrottle = new FanThrottle(); fanThrottle.Name = ItemProfiles.GetValue(xmlNode4, "Name"); fanThrottle.Value = ItemProfiles.GetValue(xmlNode4, "Value"); fanThrottle.Delta = ItemProfiles.GetValue(xmlNode4, "Delta"); try { itemProfile.ThrottleProfile.Add(fanThrottle.Name, fanThrottle); } catch (Exception) { this.SetError(string.Format("{0}: duplicate FanThrottle action Name={1} Value={2} Delta={3}", new object[] { itemProfile.Name, fanThrottle.Name, fanThrottle.Value, fanThrottle.Delta })); } } } } try { base.Add(itemProfile.Name, itemProfile); } catch (Exception) { this.SetError(string.Format("{0}: duplicate Item Profile Name={0}", itemProfile.Name)); } } } }
public static ItemProfiles GetItemProfiles() { return(ItemProfiles.GetInstance()); }