Exemplo n.º 1
0
 protected AutoCatVrSupport(AutoCatVrSupport other) : base(other)
 {
     Filter = other.Filter;
     Prefix = other.Prefix;
     IncludedVrSupportFlags = other.IncludedVrSupportFlags;
     Selected = other.Selected;
 }
        public void FillVrSupportLists()
        {
            lstVrHeadsets.Items.Clear();
            lstVrInput.Items.Clear();
            lstVrPlayArea.Items.Clear();

            if (Program.Database != null)
            {
                VrSupport vrSupport = Program.Database.GetAllVrSupportFlags();

                foreach (string s in vrSupport.Headsets)
                {
                    lstVrHeadsets.Items.Add(s);
                }

                foreach (string s in vrSupport.Input)
                {
                    lstVrInput.Items.Add(s);
                }

                foreach (string s in vrSupport.PlayArea)
                {
                    lstVrPlayArea.Items.Add(s);
                }
            }
        }
Exemplo n.º 3
0
        public override AutoCatResult CategorizeGame(GameInfo game, Filter filter)
        {
            if (games == null)
            {
                Program.Logger.Write(LoggerLevel.Error, GlobalStrings.Log_AutoCat_GamelistNull);
                throw new ApplicationException(GlobalStrings.AutoCatGenre_Exception_NoGameList);
            }

            if (db == null)
            {
                Program.Logger.Write(LoggerLevel.Error, GlobalStrings.Log_AutoCat_DBNull);
                throw new ApplicationException(GlobalStrings.AutoCatGenre_Exception_NoGameDB);
            }

            if (game == null)
            {
                Program.Logger.Write(LoggerLevel.Error, GlobalStrings.Log_AutoCat_GameNull);
                return(AutoCatResult.Failure);
            }

            if (!db.Contains(game.Id) || db.Games[game.Id].LastStoreScrape == 0)
            {
                return(AutoCatResult.NotInDatabase);
            }

            if (!game.IncludeGame(filter))
            {
                return(AutoCatResult.Filtered);
            }

            VrSupport vrSupport = db.GetVrSupport(game.Id);

            vrSupport.Headsets = vrSupport.Headsets ?? new List <string>();
            vrSupport.Input    = vrSupport.Input ?? new List <string>();
            vrSupport.PlayArea = vrSupport.PlayArea ?? new List <string>();

            IEnumerable <string> headsets = vrSupport.Headsets.Intersect(IncludedVrSupportFlags.Headsets);
            IEnumerable <string> input    = vrSupport.Input.Intersect(IncludedVrSupportFlags.Input);
            IEnumerable <string> playArea = vrSupport.PlayArea.Intersect(IncludedVrSupportFlags.PlayArea);

            foreach (string catString in headsets)
            {
                Category c = games.GetCategory(GetProcessedString(catString));
                game.AddCategory(c);
            }

            foreach (string catString in input)
            {
                Category c = games.GetCategory(GetProcessedString(catString));
                game.AddCategory(c);
            }

            foreach (string catString in playArea)
            {
                Category c = games.GetCategory(GetProcessedString(catString));
                game.AddCategory(c);
            }

            return(AutoCatResult.Success);
        }
Exemplo n.º 4
0
        public VrSupport GetVrSupport(int gameId, int depth = 3)
        {
            if (Games.ContainsKey(gameId))
            {
                VrSupport res = Games[gameId].VrSupport;
                if ((res.Headsets == null || res.Headsets.Count == 0) && (res.Input == null || res.Input.Count == 0) && (res.PlayArea == null || res.PlayArea.Count == 0) && depth > 0 && Games[gameId].ParentId > 0)
                {
                    res = GetVrSupport(Games[gameId].ParentId, depth - 1);
                }

                return(res);
            }

            return(new VrSupport());
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Returns whether the game supports VR
        /// </summary>
        public bool SupportsVr(int gameId, int depth = 3)
        {
            if (Games.ContainsKey(gameId))
            {
                VrSupport res = Games[gameId].VrSupport;
                if (res.Headsets != null && res.Headsets.Count > 0 || res.Input != null && res.Input.Count > 0 || res.PlayArea != null && res.PlayArea.Count > 0 && depth > 0 && Games[gameId].ParentId > 0)
                {
                    return(true);
                }

                if (depth > 0 && Games[gameId].ParentId > 0)
                {
                    return(SupportsVr(Games[gameId].ParentId, depth - 1));
                }
            }

            return(false);
        }