示例#1
0
        public override void SaveToAutoCat(AutoCat autocat)
        {
            AutoCatDevPub ac = autocat as AutoCatDevPub;

            if (ac == null)
            {
                return;
            }

            ac.Prefix        = txtPrefix.Text;
            ac.OwnedOnly     = chkOwnedOnly.Checked;
            ac.MinCount      = (int)list_numScore.Value;
            ac.AllDevelopers = chkAllDevelopers.Checked;
            ac.AllPublishers = chkAllPublishers.Checked;

            ac.Developers.Clear();
            if (!chkAllDevelopers.Checked)
            {
                foreach (ListViewItem item in clbDevelopersSelected.CheckedItems)
                {
                    ac.Developers.Add(item.Tag.ToString());
                }
            }

            ac.Publishers.Clear();
            if (!chkAllPublishers.Checked)
            {
                foreach (ListViewItem item in clbPublishersSelected.CheckedItems)
                {
                    ac.Publishers.Add(item.Tag.ToString());
                }
            }
        }
示例#2
0
 protected AutoCatDevPub(AutoCatDevPub other) : base(other)
 {
     Filter        = other.Filter;
     Prefix        = other.Prefix;
     OwnedOnly     = other.OwnedOnly;
     MinCount      = other.MinCount;
     AllDevelopers = other.AllDevelopers;
     AllPublishers = other.AllPublishers;
     Developers    = new List <string>(other.Developers);
     Publishers    = new List <string>(other.Publishers);
     Selected      = other.Selected;
 }
示例#3
0
        public static AutoCatDevPub LoadFromXmlElement(XmlElement xElement)
        {
            string name          = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString);
            string filter        = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null);
            bool   allDevelopers = XmlUtil.GetBoolFromNode(xElement[XmlNameAllDevelopers], false);
            bool   allPublishers = XmlUtil.GetBoolFromNode(xElement[XmlNameAllPublishers], false);
            string prefix        = XmlUtil.GetStringFromNode(xElement[XmlNamePrefix], null);
            bool   owned         = XmlUtil.GetBoolFromNode(xElement[XmlNameOwnedOnly], false);
            int    count         = XmlUtil.GetIntFromNode(xElement[XmlNameMinCount], 0);

            List <string> devs = new List <string>();

            XmlElement devsListElement = xElement[XmlNameDevelopers];

            XmlNodeList devNodes = devsListElement?.SelectNodes(XmlNameDeveloper);

            if (devNodes != null)
            {
                for (int i = 0; i < devNodes.Count; i++)
                {
                    XmlNode node = devNodes[i];
                    if (XmlUtil.TryGetStringFromNode(node, out string s))
                    {
                        devs.Add(s);
                    }
                }
            }

            List <string> pubs = new List <string>();

            XmlElement pubsListElement = xElement[XmlNamePublishers];

            XmlNodeList pubNodes = pubsListElement?.SelectNodes(XmlNamePublisher);

            if (pubNodes != null)
            {
                for (int i = 0; i < pubNodes.Count; i++)
                {
                    XmlNode node = pubNodes[i];
                    if (XmlUtil.TryGetStringFromNode(node, out string s))
                    {
                        pubs.Add(s);
                    }
                }
            }

            AutoCatDevPub result = new AutoCatDevPub(name, filter, prefix, owned, count, allDevelopers, allPublishers,
                                                     devs, pubs);

            return(result);
        }
示例#4
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);
            }
        }
示例#5
0
        public override void LoadFromAutoCat(AutoCat autocat)
        {
            AutoCatDevPub ac = autocat as AutoCatDevPub;

            if (ac == null)
            {
                return;
            }

            chkAllDevelopers.Checked = ac.AllDevelopers;
            chkAllPublishers.Checked = ac.AllPublishers;
            txtPrefix.Text           = ac.Prefix;
            list_numScore.Value      = ac.MinCount;
            chkOwnedOnly.Checked     = ac.OwnedOnly;

            FillDevList();
            FillPubList();

            lstDevelopers.BeginUpdate();
            foreach (ListViewItem item in lstDevelopers.Items)
            {
                item.Checked = ac.Developers.Contains(item.Tag.ToString());
            }

            lstDevelopers.EndUpdate();

            lstPublishers.BeginUpdate();
            foreach (ListViewItem item in lstPublishers.Items)
            {
                item.Checked = ac.Publishers.Contains(item.Tag.ToString());
            }

            lstPublishers.EndUpdate();

            loaded = true;
        }