public static AutoCatHoursPlayed LoadFromXmlElement(XmlElement xElement) { string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], string.Empty); bool includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], false); XmlNodeList rulesNodeList = xElement.SelectNodes(Serialization.Constants.Rule); List <HoursPlayedRule> rules = new List <HoursPlayedRule>(); if (rulesNodeList != null) { foreach (XmlNode node in rulesNodeList) { string ruleName = XmlUtil.GetStringFromNode(node[XmlName_Rule_Text], string.Empty); double ruleMin = XmlUtil.GetDoubleFromNode(node[XmlName_Rule_MinHours], 0); double ruleMax = XmlUtil.GetDoubleFromNode(node[XmlName_Rule_MaxHours], 0); rules.Add(new HoursPlayedRule(ruleName, ruleMin, ruleMax)); } } AutoCatHoursPlayed result = new AutoCatHoursPlayed(name, filter, prefix, includeUnknown) { Rules = rules }; return(result); }
public AutoCatHoursPlayed(AutoCatHoursPlayed other) : base(other) { Filter = other.Filter; Prefix = other.Prefix; IncludeUnknown = other.IncludeUnknown; Rules = other.Rules.ConvertAll(rule => new HoursPlayedRule(rule)); Selected = other.Selected; }
public static AutoCat LoadACFromXmlElement(XmlElement xElement) { string type = xElement.Name; switch (type) { case AutoCatGenre.TypeIdString: return(AutoCatGenre.LoadFromXmlElement(xElement)); case AutoCatFlags.TypeIdString: return(AutoCatFlags.LoadFromXmlElement(xElement)); case AutoCatTags.TypeIdString: return(AutoCatTags.LoadFromXmlElement(xElement)); case AutoCatYear.TypeIdString: return(AutoCatYear.LoadFromXmlElement(xElement)); case AutoCatUserScore.TypeIdString: return(AutoCatUserScore.LoadFromXmlElement(xElement)); case AutoCatHltb.TypeIdString: return(AutoCatHltb.LoadFromXmlElement(xElement)); case AutoCatManual.TypeIdString: return(AutoCatManual.LoadFromXmlElement(xElement)); case AutoCatDevPub.TypeIdString: return(AutoCatDevPub.LoadFromXmlElement(xElement)); case AutoCatGroup.TypeIdString: return(AutoCatGroup.LoadFromXmlElement(xElement)); case AutoCatName.TypeIdString: return(AutoCatName.LoadFromXmlElement(xElement)); case AutoCatVrSupport.TypeIdString: return(AutoCatVrSupport.LoadFromXmlElement(xElement)); case AutoCatLanguage.TypeIdString: return(AutoCatLanguage.LoadFromXmlElement(xElement)); case AutoCatCurator.TypeIdString: return(LoadFromXmlElement(xElement, typeof(AutoCatCurator))); case AutoCatPlatform.TypeIdString: return(LoadFromXmlElement(xElement, typeof(AutoCatPlatform))); case AutoCatHoursPlayed.TypeIdString: return(AutoCatHoursPlayed.LoadFromXmlElement(xElement)); default: return(null); } }