Exemplo n.º 1
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;

            default:
                break;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static AutoCatGenre LoadFromXmlElement(XmlElement xElement)
        {
            string name        = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter      = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            int    maxCats     = XmlUtil.GetIntFromNode(xElement[XmlName_MaxCats], 0);
            bool   remOther    = XmlUtil.GetBoolFromNode(xElement[XmlName_RemOther], false);
            bool   tagFallback = XmlUtil.GetBoolFromNode(xElement[XmlName_TagFallback], true);
            string prefix      = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);

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

            XmlElement ignoreListElement = xElement[XmlName_IgnoreList];

            if (ignoreListElement != null)
            {
                XmlNodeList ignoreNodes = ignoreListElement.SelectNodes(XmlName_IgnoreItem);
                foreach (XmlNode node in ignoreNodes)
                {
                    if (XmlUtil.TryGetStringFromNode(node, out string s))
                    {
                        ignore.Add(s);
                    }
                }
            }

            AutoCatGenre result = new AutoCatGenre(name, filter, prefix, maxCats, remOther, tagFallback, ignore);

            return(result);
        }
Exemplo n.º 3
0
 protected AutoCatGenre( AutoCatGenre other )
     : base( other ) {
     this.MaxCategories = other.MaxCategories;
     this.RemoveOtherGenres = other.RemoveOtherGenres;
     this.TagFallback = other.TagFallback;
     this.Prefix = other.Prefix;
     this.IgnoredGenres = new List<string>( other.IgnoredGenres );
 }
Exemplo n.º 4
0
 protected AutoCatGenre(AutoCatGenre other)
     : base(other)
 {
     this.MaxCategories     = other.MaxCategories;
     this.RemoveOtherGenres = other.RemoveOtherGenres;
     this.TagFallback       = other.TagFallback;
     this.Prefix            = other.Prefix;
     this.IgnoredGenres     = new List <string>(other.IgnoredGenres);
 }
Exemplo n.º 5
0
 protected AutoCatGenre(AutoCatGenre other) : base(other)
 {
     Filter            = other.Filter;
     MaxCategories     = other.MaxCategories;
     RemoveOtherGenres = other.RemoveOtherGenres;
     TagFallback       = other.TagFallback;
     Prefix            = other.Prefix;
     IgnoredGenres     = new List <string>(other.IgnoredGenres);
     Selected          = other.Selected;
 }
Exemplo n.º 6
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);
            }
        }
        public override void LoadFromAutoCat(AutoCat autocat)
        {
            AutoCatGenre ac = autocat as AutoCatGenre;

            if (ac == null)
            {
                return;
            }
            chkRemoveExisting.Checked = ac.RemoveOtherGenres;
            chkTagFallback.Checked    = ac.TagFallback;
            numMaxCats.Value          = ac.MaxCategories;
            txtPrefix.Text            = ac.Prefix;

            foreach (ListViewItem item in lstIgnore.Items)
            {
                item.Checked = !ac.IgnoredGenres.Contains(item.Text);
            }
        }
        public override void SaveToAutoCat(AutoCat autocat)
        {
            AutoCatGenre ac = autocat as AutoCatGenre;

            if (ac == null)
            {
                return;
            }
            ac.Prefix            = txtPrefix.Text;
            ac.MaxCategories     = (int)numMaxCats.Value;
            ac.RemoveOtherGenres = chkRemoveExisting.Checked;
            ac.TagFallback       = chkTagFallback.Checked;

            ac.IgnoredGenres.Clear();
            foreach (ListViewItem i in lstIgnore.Items)
            {
                if (!i.Checked)
                {
                    ac.IgnoredGenres.Add(i.Text);
                }
            }
        }
Exemplo n.º 9
0
        public static AutoCatGenre LoadFromXmlElement( XmlElement xElement ) {
            string name = XmlUtil.GetStringFromNode( xElement[XmlName_Name], TypeIdString );
            int maxCats = XmlUtil.GetIntFromNode( xElement[XmlName_MaxCats], 0 );
            bool remOther = XmlUtil.GetBoolFromNode( xElement[XmlName_RemOther], false );
            bool tagFallback = XmlUtil.GetBoolFromNode( xElement[XmlName_TagFallback], true );
            string prefix = XmlUtil.GetStringFromNode( xElement[XmlName_Prefix], null );

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

            XmlElement ignoreListElement = xElement[XmlName_IgnoreList];
            if( ignoreListElement != null ) {
                XmlNodeList ignoreNodes = ignoreListElement.SelectNodes( XmlName_IgnoreItem );
                foreach( XmlNode node in ignoreNodes ) {
                    string s;
                    if( XmlUtil.TryGetStringFromNode( node, out s ) ) {
                        ignore.Add( s );
                    }
                }
            }

            AutoCatGenre result = new AutoCatGenre( name, prefix, maxCats, remOther, tagFallback, ignore );
            return result;
        }
Exemplo n.º 10
0
 public static AutoCatGenre LoadFromXmlElement( XmlElement xElement )
 {
     string name = XmlUtil.GetStringFromNode( xElement[XmlName_Name], TypeIdString );
     int maxCats = XmlUtil.GetIntFromNode( xElement[XmlName_MaxCats], 0 );
     bool remOther = XmlUtil.GetBoolFromNode( xElement[XmlName_RemOther], false );
     AutoCatGenre result = new AutoCatGenre( name, maxCats, remOther );
     return result;
 }