示例#1
0
 public AutoCatHltb(AutoCatHltb other) : base(other)
 {
     Filter         = other.Filter;
     Prefix         = other.Prefix;
     IncludeUnknown = other.IncludeUnknown;
     UnknownText    = other.UnknownText;
     Rules          = other.Rules.ConvertAll(rule => new Hltb_Rule(rule));
     Selected       = other.Selected;
 }
示例#2
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);
            }
        }
示例#3
0
        public static void GenerateDefaultAutoCatSet(List <AutoCat> list)
        {
            if (list == null)
            {
                list = new List <AutoCat>();
            }

            //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 (KeyValuePair <string, float> tag in Database.CalculateSortedTagList(null, 1, 20, 0, false, false))
            {
                act.IncludedTags.Add(tag.Key);
            }

            list.Add(act);

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

            foreach (string flag in Database.AllFlags)
            {
                acf.IncludedFlags.Add(flag);
            }

            list.Add(acf);

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

            ach.Rules.Add(new HowLongToBeatRule(" 0-5", 0, 5, TimeType.Extras));
            ach.Rules.Add(new HowLongToBeatRule(" 5-10", 5, 10, TimeType.Extras));
            ach.Rules.Add(new HowLongToBeatRule("10-20", 10, 20, TimeType.Extras));
            ach.Rules.Add(new HowLongToBeatRule("20-50", 20, 50, TimeType.Extras));
            ach.Rules.Add(new HowLongToBeatRule("50+", 20, 0, TimeType.Extras));
            list.Add(ach);

            //By Platform
            AutoCatPlatform acPlatform = new AutoCatPlatform(GlobalStrings.Profile_DefaultAutoCatName_Platform, null, "(" + GlobalStrings.AutoCat_Name_Platform + ") ", true, true, true, true);

            list.Add(acPlatform);
        }
示例#4
0
        public static AutoCat LoadACFromXmlElement(XmlElement xElement)
        {
            string type = xElement.Name;

            AutoCat result = null;

            switch (type)
            {
            case AutoCatGenre.TypeIdString:
                result = AutoCatGenre.LoadFromXmlElement(xElement);
                break;

            case AutoCatFlags.TypeIdString:
                result = AutoCatFlags.LoadFromXmlElement(xElement);
                break;

            case AutoCatTags.TypeIdString:
                result = AutoCatTags.LoadFromXmlElement(xElement);
                break;

            case AutoCatYear.TypeIdString:
                result = AutoCatYear.LoadFromXmlElement(xElement);
                break;

            case AutoCatUserScore.TypeIdString:
                result = AutoCatUserScore.LoadFromXmlElement(xElement);
                break;

            case AutoCatHltb.TypeIdString:
                result = AutoCatHltb.LoadFromXmlElement(xElement);
                break;

            case AutoCatManual.TypeIdString:
                result = AutoCatManual.LoadFromXmlElement(xElement);
                break;

            case AutoCatDevPub.TypeIdString:
                result = AutoCatDevPub.LoadFromXmlElement(xElement);
                break;

            case AutoCatGroup.TypeIdString:
                result = AutoCatGroup.LoadFromXmlElement(xElement);
                break;

            case AutoCatName.TypeIdString:
                result = AutoCatName.LoadFromXmlElement(xElement);
                break;

            default:
                break;
            }
            return(result);
        }
示例#5
0
        /// <summary>
        /// Generates default autocats and adds them to a list
        /// </summary>
        /// <param name="list">The list where the autocats should be added</param>
        public static void GenerateDefaultAutoCatSet(List <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 HLTB
            AutoCatHltb ach = new AutoCatHltb(GlobalStrings.Profile_DefaultAutoCatName_Hltb, null, "(HLTB) ", false);

            ach.Rules.Add(new Hltb_Rule(" 0-5", 0, 5, TimeType.Extras));
            ach.Rules.Add(new Hltb_Rule(" 5-10", 5, 10, TimeType.Extras));
            ach.Rules.Add(new Hltb_Rule("10-20", 10, 20, TimeType.Extras));
            ach.Rules.Add(new Hltb_Rule("20-50", 20, 50, TimeType.Extras));
            ach.Rules.Add(new Hltb_Rule("50+", 20, 0, TimeType.Extras));
            list.Add(ach);

            //By Platform
            AutoCatPlatform acPlatform = new AutoCatPlatform(GlobalStrings.Profile_DefaultAutoCatName_Platform, null, "(" + GlobalStrings.AutoCat_Name_Platform + ") ", true, true, true, true);

            list.Add(acPlatform);
        }
示例#6
0
        public override void SaveToAutoCat(AutoCat autoCat)
        {
            AutoCatHltb acHltb = autoCat as AutoCatHltb;

            if (acHltb == null)
            {
                return;
            }

            acHltb.Prefix         = txtPrefix.Text;
            acHltb.IncludeUnknown = chkIncludeUnknown.Checked;
            acHltb.UnknownText    = txtUnknownText.Text;
            acHltb.Rules          = new List <Hltb_Rule>(ruleList);
        }
示例#7
0
        public static AutoCatHltb 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);
            string unknownText    = XmlUtil.GetStringFromNode(xElement[XmlName_UnknownText], string.Empty);

            XmlNodeList rulesNodeList      = xElement.SelectNodes(XmlName_Rule);
            List <HowLongToBeatRule> rules = new List <HowLongToBeatRule>();

            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);
                    string type     = XmlUtil.GetStringFromNode(node[XmlName_Rule_TimeType], string.Empty);

                    TimeType ruleTimeType;
                    switch (type)
                    {
                    case "Extras":
                        ruleTimeType = TimeType.Extras;
                        break;

                    case "Completionist":
                        ruleTimeType = TimeType.Completionist;
                        break;

                    default:
                        ruleTimeType = TimeType.Main;
                        break;
                    }

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

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

            return(result);
        }
        public override void LoadFromAutoCat(AutoCat ac)
        {
            AutoCatHltb acHltb = ac as AutoCatHltb;

            if (acHltb == null)
            {
                return;
            }

            txtPrefix.Text            = acHltb.Prefix;
            chkIncludeUnknown.Checked = acHltb.IncludeUnknown;
            txtUnknownText.Text       = (acHltb.UnknownText == null) ? string.Empty : acHltb.UnknownText;
            acHltb.IncludeUnknown     = chkIncludeUnknown.Checked;
            acHltb.UnknownText        = txtUnknownText.Text;

            ruleList.Clear();
            foreach (Hltb_Rule rule in acHltb.Rules)
            {
                ruleList.Add(new Hltb_Rule(rule));
            }
            UpdateEnabledSettings();
        }
示例#9
0
 public AutoCatHltb( AutoCatHltb other )
     : base( other ) {
     Prefix = other.Prefix;
     IncludeUnknown = other.IncludeUnknown;
     UnknownText = other.UnknownText;
     Rules = other.Rules.ConvertAll( rule => new Hltb_Rule( rule ) );
 }
示例#10
0
        public static AutoCatHltb LoadFromXmlElement( XmlElement xElement ) {
            string name = XmlUtil.GetStringFromNode( xElement[XmlName_Name], TypeIdString );
            string prefix = XmlUtil.GetStringFromNode( xElement[XmlName_Prefix], string.Empty );
            bool includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], false);
            string unknownText = XmlUtil.GetStringFromNode(xElement[XmlName_UnknownText], string.Empty);

            List<Hltb_Rule> rules = new List<Hltb_Rule>();
            foreach( XmlNode node in xElement.SelectNodes( XmlName_Rule ) ) {
                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 );
                string type = XmlUtil.GetStringFromNode(node[XmlName_Rule_TimeType], string.Empty);
                TimeType ruleTimeType;
                switch (type)
                {
                    case "Extras":
                        ruleTimeType = TimeType.Extras;
                        break;
                    case "Completionist":
                        ruleTimeType = TimeType.Completionist;
                        break;
                    default:
                        ruleTimeType = TimeType.Main;
                        break;
                }
                rules.Add( new Hltb_Rule( ruleName, ruleMin, ruleMax, ruleTimeType ) );
            }
            AutoCatHltb result = new AutoCatHltb(name, prefix, includeUnknown, unknownText) {Rules = rules};
            return result;
        }
示例#11
0
 public AutoCatHltb( AutoCatHltb other )
     : base( other ) {
     Filter = other.Filter;
     Prefix = other.Prefix;
     IncludeUnknown = other.IncludeUnknown;
     UnknownText = other.UnknownText;
     Rules = other.Rules.ConvertAll( rule => new Hltb_Rule( rule ) );
     Selected = other.Selected;
 }