Пример #1
0
        private void RunAutoCats(Profile profile, IEnumerable <AutoCat> autoCats)
        {
            if (profile == null || autoCats == null)
            {
                return;
            }

            foreach (AutoCat autoCat in autoCats)
            {
                Write("Running AutoCat '" + autoCat.Name + "'...");
                autoCat.PreProcess(profile.GameData);

                if (autoCat.AutoCatType == AutoCatType.Group)
                {
                    AutoCatGroup autoCatGroup = (AutoCatGroup)autoCat;
                    RunAutoCats(profile, profile.CloneAutoCatList(autoCatGroup.Autocats, profile.GameData.GetFilter(autoCatGroup.Filter)));
                }
                else
                {
                    foreach (GameInfo g in profile.GameData.Games.Values)
                    {
                        if (g.Id > 0)
                        {
                            autoCat.CategorizeGame(g, profile.GameData.GetFilter(autoCat.Filter));
                        }
                    }
                }

                autoCat.DeProcess();
                WriteLine(autoCat.Name + " complete.");
            }
        }
Пример #2
0
 protected AutoCatGroup(AutoCatGroup other)
     : base(other)
 {
     Filter   = other.Filter;
     Autocats = new List <string>(other.Autocats);
     Selected = other.Selected;
 }
Пример #3
0
        private void RunAutoCats(Profile p, List <AutoCat> autocats)
        {
            foreach (AutoCat ac in autocats)
            {
                Write("Running autocat '" + ac.Name + "'...");
                ac.PreProcess(p.GameData, Database);

                if (ac.AutoCatType == AutoCatType.Group)
                {
                    AutoCatGroup acg = (AutoCatGroup)ac;
                    RunAutoCats(p, p.CloneAutoCatList(acg.Autocats, p.GameData.GetFilter(acg.Filter)));
                }
                else
                {
                    foreach (GameInfo g in p.GameData.Games.Values)
                    {
                        if (g.Id > 0)
                        {
                            ac.CategorizeGame(g, p.GameData.GetFilter(ac.Filter));
                        }
                    }
                }

                ac.DeProcess();
                WriteLine(ac.Name + " complete.");
            }
        }
Пример #4
0
 private bool SafeGroup(List <string> autocats, List <string> groups)
 {
     foreach (string ac in autocats)
     {
         // is AutoCat a group?
         if (IsGroup(ac))
         {
             // if group list already contains the group then we are stuck in an infinite loop.  RETURN FALSE.
             if (groups.Contains(ac))
             {
                 return(false);
             }
             else
             {
                 // add new group to group list
                 groups.Add(ac);
                 // get AutoCat from group name
                 AutoCatGroup group = GetAutoCat(ac) as AutoCatGroup;
                 // send new group to SafeGroup to continue testing
                 return(SafeGroup(group.Autocats, groups));
             }
         }
     }
     // no duplicate group found.  All good! RETURN TRUE.
     return(true);
 }
Пример #5
0
        public override void SaveToAutoCat(AutoCat autocat)
        {
            AutoCatGroup ac = autocat as AutoCatGroup;

            if (ac == null)
            {
                return;
            }
            ac.Autocats = GetGroup();
        }
Пример #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);
            }
        }
Пример #7
0
        public override void LoadFromAutoCat(AutoCat autocat)
        {
            AutoCatGroup ac = autocat as AutoCatGroup;

            current = autocat;
            if (ac == null)
            {
                return;
            }
            FillAutocatList(ac.Autocats);
        }
Пример #8
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);
        }
Пример #9
0
 protected AutoCatGroup( AutoCatGroup other )
     : base( other ) {
     Filter = other.Filter;
     Autocats = new List<string>(other.Autocats);
     Selected = other.Selected;
 }