示例#1
0
        public string Dump()
        {
            string text = "Drivelist" + Environment.NewLine;

            if (!string.IsNullOrEmpty(this.version))
            {
                text = text + "  Version=" + this.version + Environment.NewLine;
            }
            if (this.entries != null)
            {
                using (List <DrivelistEntry> .Enumerator enumerator = this.entries.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        DrivelistEntry drivelistEntry = enumerator.Current;
                        text += string.Format("  Model={0}, Description={1}, Size={2}, Type={3}, ItemProfile={4}, Category={5}", new object[]
                        {
                            drivelistEntry.Model,
                            drivelistEntry.Description,
                            drivelistEntry.Size,
                            drivelistEntry.Type.ToString(),
                            drivelistEntry.Profile,
                            drivelistEntry.Category
                        });
                        text += Environment.NewLine;
                    }
                    goto IL_E9;
                }
            }
            text += "Empty list";
IL_E9:
            text += Environment.NewLine;
            return(text);
        }
示例#2
0
        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);
        }
示例#3
0
 public void Load(XmlNodeList nodes)
 {
     this.entries = new List <DrivelistEntry>();
     foreach (object obj in nodes)
     {
         XmlNode xmlNode = (XmlNode)obj;
         if (xmlNode.NodeType != XmlNodeType.Comment)
         {
             DrivelistEntry drivelistEntry = new DrivelistEntry();
             drivelistEntry.Description = xmlNode.Attributes["Description"].Value;
             drivelistEntry.Model       = xmlNode.Attributes["Model"].Value;
             string value = xmlNode.Attributes["Size"].Value;
             if (value == "*")
             {
                 drivelistEntry.Size    = 0UL;
                 drivelistEntry.AnySize = true;
             }
             else
             {
                 drivelistEntry.Size    = ulong.Parse(value);
                 drivelistEntry.AnySize = false;
             }
             if (xmlNode.Attributes["Type"] != null)
             {
                 value = xmlNode.Attributes["Type"].Value;
                 if (value == null)
                 {
                     drivelistEntry.Type = DrivelistEntryType.TYPE_CONSTANT;
                 }
                 else if (value == "re")
                 {
                     drivelistEntry.Type = DrivelistEntryType.TYPE_RE;
                 }
                 else if (value == "constant")
                 {
                     drivelistEntry.Type = DrivelistEntryType.TYPE_CONSTANT;
                 }
             }
             drivelistEntry.Profile = xmlNode.Attributes["ItemProfile"].Value;
             value = xmlNode.Attributes["Category"].Value;
             if (value == "Preferred")
             {
                 drivelistEntry.Category = DrivelistEntryCategory.CATEGORY_PREFERRED;
             }
             else if (value == "Supported")
             {
                 drivelistEntry.Category = DrivelistEntryCategory.CATEGORY_SUPPORTED;
             }
             else
             {
                 if (!(value == "Blacklisted"))
                 {
                     string message = string.Format("Unknown drive list entry category {0}", value);
                     throw new Exception(message);
                 }
                 drivelistEntry.Category = DrivelistEntryCategory.CATEGORY_BLACKLISTED;
             }
             this.entries.Add(drivelistEntry);
         }
     }
 }