internal static void ParseLimitValues(ILimitsConfiguration config, XmlElement root, string nodeName) { foreach (XmlNode node in root.ChildNodes) { var grandchild = node as XmlElement; if (grandchild == null) { continue; } if (grandchild.LocalName.Equals("Limit") && grandchild.HasAttribute("Name") && (grandchild.HasAttribute("SoftLimit") || grandchild.HasAttribute("HardLimit"))) { var limitName = grandchild.GetAttribute("Name"); config.LimitValues.Add(limitName, new LimitValue { Name = limitName, SoftLimitThreshold = ParseInt(grandchild.GetAttribute("SoftLimit"), "Invalid integer value for the SoftLimit attribute on the Limit element"), HardLimitThreshold = grandchild.HasAttribute("HardLimit") ? ParseInt(grandchild.GetAttribute("HardLimit"), "Invalid integer value for the HardLimit attribute on the Limit element") : 0, }); } } }
public static void UnInitialize() { limitsConfig = null; }
public static void Initialize(ILimitsConfiguration limitValues) { limitsConfig = limitValues; }