Ejemplo n.º 1
0
        public FanThrottle GetFanThrottle(string itemName, string actionName)
        {
            FanThrottle result = null;

            try
            {
                ItemProfile itemProfile = base[itemName];
                if (itemProfile != null)
                {
                    result = itemProfile.ThrottleProfile[actionName];
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Ejemplo n.º 2
0
 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));
             }
         }
     }
 }