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

            if (ac == null)
            {
                return;
            }

            ac.Prefix = txtPrefix.Text;
            ac.RemoveAllCategories = chkRemoveAll.Checked;

            ac.RemoveCategories.Clear();
            if (!chkRemoveAll.Checked)
            {
                foreach (ListViewItem item in clbRemoveSelected.CheckedItems)
                {
                    ac.RemoveCategories.Add(item.Name);
                }
            }

            ac.AddCategories.Clear();
            foreach (ListViewItem item in clbAddSelected.CheckedItems)
            {
                ac.AddCategories.Add(item.Name);
            }
        }
示例#2
0
        public override void LoadFromAutoCat(AutoCat autocat)
        {
            AutoCatManual ac = autocat as AutoCatManual;

            if (ac == null)
            {
                return;
            }
            chkRemoveAll.Checked = ac.RemoveAllCategories;
            txtPrefix.Text       = ac.Prefix;

            lstRemove.BeginUpdate();

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

            foreach (ListViewItem item in lstRemove.Items)
            {
                item.Checked = ac.RemoveCategories.Contains(item.Name);
                found.Add(item.Name);
            }
            lstRemove.EndUpdate();

            foreach (string s in ac.RemoveCategories)
            {
                if (!found.Contains(s))
                {
                    ListViewItem l = new ListViewItem();
                    l.Text = s;
                    l.Name = s;
                    clbRemoveSelected.Items.Add(l, true);
                }
            }

            lstAdd.BeginUpdate();
            found = new List <string>();
            foreach (ListViewItem item in lstAdd.Items)
            {
                item.Checked = ac.AddCategories.Contains(item.Name);
                found.Add(item.Name);
            }
            lstAdd.EndUpdate();

            foreach (string s in ac.AddCategories)
            {
                if (!found.Contains(s))
                {
                    ListViewItem l = new ListViewItem();
                    l.Text = s;
                    l.Name = s;
                    clbAddSelected.Items.Add(l, true);
                }
            }

            UpdateRemoveCount();
            UpdateAddCount();

            loaded = true;
        }
 protected AutoCatManual(AutoCatManual other) : base(other)
 {
     Filter = other.Filter;
     Prefix = other.Prefix;
     RemoveAllCategories = other.RemoveAllCategories;
     RemoveCategories    = new List <string>(other.RemoveCategories);
     AddCategories       = new List <string>(other.AddCategories);
     Selected            = other.Selected;
 }
 protected AutoCatManual(AutoCatManual other)
     : base(other)
 {
     Filter = other.Filter;
     Prefix = other.Prefix;
     RemoveAllCategories = other.RemoveAllCategories;
     RemoveCategories = new List<string>(other.RemoveCategories);
     AddCategories = new List<string>(other.AddCategories);
     Selected = other.Selected;
 }
示例#5
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);
            }
        }
示例#6
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);
        }
        public static AutoCatManual LoadFromXmlElement(XmlElement xElement)
        {
            string name      = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter    = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            bool   removeAll = XmlUtil.GetBoolFromNode(xElement[XmlName_RemoveAll], false);
            string prefix    = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);

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

            XmlElement removeListElement = xElement[XmlName_RemoveList];

            if (removeListElement != null)
            {
                XmlNodeList removeNodes = removeListElement.SelectNodes(XmlName_RemoveItem);
                foreach (XmlNode node in removeNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        remove.Add(s);
                    }
                }
            }

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

            XmlElement addListElement = xElement[XmlName_AddList];

            if (addListElement != null)
            {
                XmlNodeList addNodes = addListElement.SelectNodes(XmlName_AddItem);
                foreach (XmlNode node in addNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        add.Add(s);
                    }
                }
            }

            AutoCatManual result = new AutoCatManual(name, filter, prefix, removeAll, remove, add);

            return(result);
        }
        public static AutoCatManual LoadFromXmlElement(XmlElement xElement)
        {
            string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            bool removeAll = XmlUtil.GetBoolFromNode(xElement[XmlName_RemoveAll], false);
            string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);

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

            XmlElement removeListElement = xElement[XmlName_RemoveList];
            if (removeListElement != null)
            {
                XmlNodeList removeNodes = removeListElement.SelectNodes(XmlName_RemoveItem);
                foreach (XmlNode node in removeNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        remove.Add(s);
                    }
                }
            }

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

            XmlElement addListElement = xElement[XmlName_AddList];
            if (addListElement != null)
            {
                XmlNodeList addNodes = addListElement.SelectNodes(XmlName_AddItem);
                foreach (XmlNode node in addNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        add.Add(s);
                    }
                }
            }

            AutoCatManual result = new AutoCatManual(name, filter, prefix, removeAll, remove, add);
            return result;
        }