Cindeck.ViewModels.IdolFilter.FilterIdols C# (CSharp) Method

FilterIdols() private method

private FilterIdols ( object obj ) : bool
obj object
return bool
        private bool FilterIdols(object obj)
        {
            var idol = obj as IIdol;
            var ok = TypeFilter.HasFlag(idol.Category);

            if (FilterOwned)
            {
                ok &= !m_config.OwnedIdols.Any(x => x.Iid == idol.Iid);
            }

            if (!string.IsNullOrEmpty(NameFilter))
            {
                ok &= idol.Name.ToLower().Contains(NameFilter.ToLower()) ||
                    (idol.Label != null && idol.Label.ToLower().Contains(NameFilter.ToLower()));
            }

            if (RarityFilter != null)
            {
                ok &= idol.Rarity == RarityFilter;
            }

            if (CenterEffectFilter != null)
            {
                ok &= idol.CenterEffect != null && idol.CenterEffect.GetType() == CenterEffectFilter;
            }

            if (SkillFilter != null)
            {
                ok &= idol.Skill != null && idol.Skill.GetType() == SkillFilter;
            }

            if(ShowOwnedOnly)
            {
                ok &= m_config.OwnedIdols.Any(x => x.Name == idol.Name);
            }
            return ok;
        }