public override void SaveToAutoCat(AutoCat autocat)
        {
            AutoCatTags ac = autocat as AutoCatTags;

            if (ac == null)
            {
                return;
            }

            ac.Prefix = txtPrefix.Text;

            ac.MaxTags = (int)numMaxTags.Value;

            ac.IncludedTags = new HashSet <string>();
            foreach (ListViewItem i in lstIncluded.CheckedItems)
            {
                ac.IncludedTags.Add(i.Tag as string);
            }

            ac.ListMinScore      = (int)list_numMinScore.Value;
            ac.ListOwnedOnly     = list_chkOwnedOnly.Checked;
            ac.ListTagsPerGame   = (int)list_numTagsPerGame.Value;
            ac.ListWeightFactor  = (float)list_numWeightFactor.Value;
            ac.ListExcludeGenres = list_chkExcludeGenres.Checked;
        }
Beispiel #2
0
        public static AutoCatTags LoadFromXmlElement(XmlElement xElement)
        {
            string name = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString);

            AutoCatTags result = new AutoCatTags(name);

            result.Filter = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null);

            if (XmlUtil.TryGetStringFromNode(xElement[XmlNamePrefix], out string prefix))
            {
                result.Prefix = prefix;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlNameMaxTags], out int maxTags))
            {
                result.MaxTags = maxTags;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlNameListOwnedOnly], out bool listOwnedOnly))
            {
                result.ListOwnedOnly = listOwnedOnly;
            }

            if (XmlUtil.TryGetFloatFromNode(xElement[XmlNameListWeightFactor], out float listWeightFactor))
            {
                result.ListWeightFactor = listWeightFactor;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlNameListMinScore], out int listMinScore))
            {
                result.ListMinScore = listMinScore;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlNameListTagsPerGame], out int listTagsPerGame))
            {
                result.ListTagsPerGame = listTagsPerGame;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlNameListScoreSort], out bool listScoreSort))
            {
                result.ListScoreSort = listScoreSort;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlNameListExcludeGenres], out bool listExcludeGenres))
            {
                result.ListExcludeGenres = listExcludeGenres;
            }

            List <string> tagList =
                XmlUtil.GetStringsFromNodeList(xElement.SelectNodes(XmlNameTagList + "/" + XmlNameTag));

            result.IncludedTags = tagList == null ? new HashSet <string>() : new HashSet <string>(tagList);

            return(result);
        }
Beispiel #3
0
        protected AutoCatTags(AutoCatTags other) : base(other)
        {
            Filter       = other.Filter;
            Prefix       = other.Prefix;
            IncludedTags = new HashSet <string>(other.IncludedTags);
            MaxTags      = other.MaxTags;

            ListOwnedOnly     = other.ListOwnedOnly;
            ListWeightFactor  = other.ListWeightFactor;
            ListMinScore      = other.ListMinScore;
            ListTagsPerGame   = other.ListTagsPerGame;
            ListScoreSort     = other.ListScoreSort;
            ListExcludeGenres = other.ListExcludeGenres;
            Selected          = other.Selected;
        }
        public override void LoadFromAutoCat(AutoCat autocat)
        {
            AutoCatTags ac = autocat as AutoCatTags;

            if (ac == null)
            {
                return;
            }

            txtPrefix.Text   = ac.Prefix == null ? string.Empty : ac.Prefix;
            numMaxTags.Value = ac.MaxTags;

            list_numMinScore.Value        = ac.ListMinScore;
            list_numTagsPerGame.Value     = ac.ListTagsPerGame;
            list_chkOwnedOnly.Checked     = ac.ListOwnedOnly;
            list_numWeightFactor.Value    = (decimal)ac.ListWeightFactor;
            list_chkExcludeGenres.Checked = ac.ListExcludeGenres;

            FillTagsList(ac.IncludedTags);

            loaded = true;
        }
Beispiel #5
0
        /// <summary>
        /// </summary>
        /// <param name="xElement"></param>
        /// <returns></returns>
        public static AutoCat LoadAutoCatFromXmlElement(XmlElement xElement)
        {
            switch (xElement.Name)
            {
            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));

            default:
                return(null);
            }
        }