Exemple #1
0
        public static AutoCatHoursPlayed LoadFromXmlElement(XmlElement xElement)
        {
            string name           = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter         = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            string prefix         = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], string.Empty);
            bool   includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], false);

            XmlNodeList            rulesNodeList = xElement.SelectNodes(XmlName_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);
                    float  ruleMin  = XmlUtil.GetFloatFromNode(node[XmlName_Rule_MinHours], 0);
                    float  ruleMax  = XmlUtil.GetFloatFromNode(node[XmlName_Rule_MaxHours], 0);

                    rules.Add(new HoursPlayedRule(ruleName, ruleMin, ruleMax));
                }
            }

            AutoCatHoursPlayed result = new AutoCatHoursPlayed(name, filter, prefix, includeUnknown)
            {
                Rules = rules
            };

            return(result);
        }
Exemple #2
0
 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;
 }
Exemple #3
0
        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);
            }
        }