HasCategories() public method

Check to see if the game has any categories at all (except the Favorite category)
public HasCategories ( bool includeFavorite = false ) : bool
includeFavorite bool If true, will only return true if the game is not in the favorite category. If false, the favorite category is ignored.
return bool
コード例 #1
0
ファイル: MainForm.cs プロジェクト: caballinger/depressurizer
        bool ShouldDisplayGameAdvanced( GameInfo g ) {
            bool isCategorized = false;
            bool isHidden = false;
            if( advFilterUncatState != AdvancedFilterState.None ) isCategorized = g.HasCategories();
            if (advFilterHiddenState != AdvancedFilterState.None) isHidden = g.Hidden;

            if (advFilterUncatState == AdvancedFilterState.Require && isCategorized) return false;
            if (advFilterHiddenState == AdvancedFilterState.Require && !isHidden) return false;

            if (advFilterUncatState == AdvancedFilterState.Exclude && !isCategorized) return false;
            if (advFilterHiddenState == AdvancedFilterState.Exclude && isHidden) return false;

            if (advFilterUncatState == AdvancedFilterState.Allow || advFilterHiddenState == AdvancedFilterState.Allow || advFilterAllow.Count > 0)
            {
                if( advFilterUncatState != AdvancedFilterState.Allow || isCategorized ) {
                    if ( advFilterHiddenState != AdvancedFilterState.Allow || !isHidden )
                    {
                        if (!g.Categories.Overlaps(advFilterAllow)) return false;
                    }
                }
            }

            if( !g.Categories.IsSupersetOf( advFilterRequire ) ) return false;

            if( g.Categories.Overlaps( advFilterExclude ) ) return false;

            return true;
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: caballinger/depressurizer
        /// <summary>
        /// Checks to see if a game should currently be displayed, based on the state of the category list.
        /// </summary>
        /// <param name="g">Game to check</param>
        /// <returns>True if it should be displayed, false otherwise</returns>
        bool ShouldDisplayGame( GameInfo g ) {
            if( currentProfile == null ) return false;
            if( txtSearch.Text != string.Empty && g.Name.IndexOf( txtSearch.Text, StringComparison.CurrentCultureIgnoreCase ) == -1 ) return false;
            if( !currentProfile.GameData.Games.ContainsKey( g.Id ) ) return false;
            if( g.Id < 0 && !currentProfile.IncludeShortcuts ) return false;

            if( lstCategories.SelectedItems.Count == 0 ) return false;


            if( AdvancedCategoryFilter ) {
                return ShouldDisplayGameAdvanced( g );
            }

            if (g.Hidden)
            {
                return (lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_Hidden);
            }


            if( lstCategories.SelectedItems[0].Tag is Category ) {
                return g.ContainsCategory( lstCategories.SelectedItems[0].Tag as Category );
            } else {
                if( lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_All ) {
                    return true;
                }
                if( lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_Uncategorized ) {
                    return !g.HasCategories();
                }
            }

            return false;
        }