public AutoCatUserScore( AutoCatUserScore other )
     : base( other ) {
     Filter = other.Filter;
     Prefix = other.Prefix;
     Rules = other.Rules.ConvertAll( rule => new UserScore_Rule( rule ) );
     Selected = other.Selected;
 }
Beispiel #2
0
        public static AutoCatUserScore 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   useWilsonScore = XmlUtil.GetBoolFromNode(xElement[XmlName_UseWilsonScore], false);

            List <UserScore_Rule> rules = new List <UserScore_Rule>();

            foreach (XmlNode node in xElement.SelectNodes(XmlName_Rule))
            {
                string ruleName   = XmlUtil.GetStringFromNode(node[XmlName_Rule_Text], string.Empty);
                int    ruleMin    = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinScore], 0);
                int    ruleMax    = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxScore], 100);
                int    ruleMinRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinReviews], 0);
                int    ruleMaxRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxReviews], 0);
                rules.Add(new UserScore_Rule(ruleName, ruleMin, ruleMax, ruleMinRev, ruleMaxRev));
            }
            AutoCatUserScore result = new AutoCatUserScore(name, filter, prefix, useWilsonScore);

            result.Rules = rules;
            return(result);
        }
        public static AutoCatUserScore 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 useWilsonScore = XmlUtil.GetBoolFromNode( xElement[XmlName_UseWilsonScore], false );

            List<UserScore_Rule> rules = new List<UserScore_Rule>();
            foreach( XmlNode node in xElement.SelectNodes( XmlName_Rule ) ) {
                string ruleName = XmlUtil.GetStringFromNode( node[XmlName_Rule_Text], string.Empty );
                int ruleMin = XmlUtil.GetIntFromNode( node[XmlName_Rule_MinScore], 0 );
                int ruleMax = XmlUtil.GetIntFromNode( node[XmlName_Rule_MaxScore], 100 );
                int ruleMinRev = XmlUtil.GetIntFromNode( node[XmlName_Rule_MinReviews], 0 );
                int ruleMaxRev = XmlUtil.GetIntFromNode( node[XmlName_Rule_MaxReviews], 0 );
                rules.Add( new UserScore_Rule( ruleName, ruleMin, ruleMax, ruleMinRev, ruleMaxRev ) );
            }
            AutoCatUserScore result = new AutoCatUserScore( name, filter, prefix, useWilsonScore );
            result.Rules = rules;
            return result;
        }
 public AutoCatUserScore( AutoCatUserScore other )
     : base( other ) {
     Prefix = other.Prefix;
     Rules = other.Rules.ConvertAll( rule => new UserScore_Rule( rule ) );
 }
 public AutoCatUserScore(AutoCatUserScore other)
     : base(other)
 {
     Prefix = other.Prefix;
     Rules  = other.Rules.ConvertAll(rule => new UserScore_Rule(rule));
 }
Beispiel #6
0
        public static void GenerateDefaultAutoCatSet(List <AutoCat.AutoCat> list)
        {
            //By Genre
            list.Add(new AutoCatGenre(GlobalStrings.Profile_DefaultAutoCatName_Genre, null,
                                      "(" + GlobalStrings.Name_Genre + ") "));

            //By Year
            list.Add(new AutoCatYear(GlobalStrings.Profile_DefaultAutoCatName_Year, null,
                                     "(" + GlobalStrings.Name_Year + ") "));

            //By Score
            AutoCatUserScore ac = new AutoCatUserScore(GlobalStrings.Profile_DefaultAutoCatName_UserScore, null,
                                                       "(" + GlobalStrings.Name_Score + ") ");

            ac.GenerateSteamRules(ac.Rules);
            list.Add(ac);

            //By Tags
            AutoCatTags act = new AutoCatTags(GlobalStrings.Profile_DefaultAutoCatName_Tags, null,
                                              "(" + GlobalStrings.Name_Tags + ") ");

            foreach (Tuple <string, float> tag in Program.GameDB.CalculateSortedTagList(null, 1, 20, 0, false, false))
            {
                act.IncludedTags.Add(tag.Item1);
            }
            list.Add(act);

            //By Flags
            AutoCatFlags acf = new AutoCatFlags(GlobalStrings.Profile_DefaultAutoCatName_Flags, null,
                                                "(" + GlobalStrings.Name_Flags + ") ");

            foreach (string flag in Program.GameDB.GetAllStoreFlags())
            {
                acf.IncludedFlags.Add(flag);
            }
            list.Add(acf);

            //By Developer
            AutoCatDevPub acd = new AutoCatDevPub(GlobalStrings.Profile_DefaultAutoCatName_Developer, null,
                                                  "(" + GlobalStrings.Name_Developer + ") ");

            acd.AllDevelopers = true;
            list.Add(acd);

            //By Publisher
            AutoCatDevPub acp = new AutoCatDevPub(GlobalStrings.Profile_DefaultAutoCatName_Publisher, null,
                                                  "(" + GlobalStrings.Name_Publisher + ") ");

            acp.AllPublishers = true;
            list.Add(acp);

            //By HLTB
            AutoCatHltb ach = new AutoCatHltb(GlobalStrings.Profile_DefaultAutoCatName_Hltb, null, "(HLTB) ", false);

            ach.Rules.Add(new HltbRule("0-5", 0, 5, TimeType.Extras));
            ach.Rules.Add(new HltbRule("5-10", 5, 10, TimeType.Extras));
            ach.Rules.Add(new HltbRule("10-20", 10, 20, TimeType.Extras));
            ach.Rules.Add(new HltbRule("20-50", 20, 50, TimeType.Extras));
            ach.Rules.Add(new HltbRule("50+", 20, 0, TimeType.Extras));
            list.Add(ach);
        }
Beispiel #7
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)));

            default:

                return(null);
            }
        }
Beispiel #8
0
 public static void GenerateDefaultAutoCatSet( List<AutoCat> list ) {
     list.Add( new AutoCatGenre( GlobalStrings.Profile_DefaultAutoCatName_Genre ) );
     list.Add(new AutoCatYear(GlobalStrings.Profile_DefaultAutoCatName_Year));
     AutoCatUserScore ac = new AutoCatUserScore(GlobalStrings.Profile_DefaultAutoCatName_UserScore);
     ac.GenerateSteamRules(ac.Rules);
     list.Add(ac);
     list.Add(new AutoCatTags(GlobalStrings.Profile_DefaultAutoCatName_Tags));
     list.Add(new AutoCatFlags(GlobalStrings.Profile_DefaultAutoCatName_Flags));
     list.Add(new AutoCatDevPub(GlobalStrings.Profile_DefaultAutoCatName_DevPub));
     list.Add(new AutoCatHltb(GlobalStrings.Profile_DefaultAutoCatName_Hltb));
 }