Esempio n. 1
0
        private bool CheckPerimeter(ICardAllDbInfo cai)
        {
            if (PerimeterScope == PerimeterScope.All)
            {
                return(true);
            }

            IEnumerable <ICardInCollectionCount> cardStats = CountIsNameBased ? cai.Statistics :
                                                             //We filter statitiscs on only current version of the card
                                                             cai.Statistics.Where(s => s.IdGatherer == cai.IdGatherer);

            //Filter on collection
            ICardInCollectionCount[] statistics = cardStats.Where(s => CollectionsSelected.Any(cc => cc.Id == s.IdCollection)).ToArray();

            int count = statistics.Sum(stat => stat.Number);

            if (CountIncludeFoil)
            {
                count += statistics.Sum(stat => stat.FoilNumber);
            }
            if (CountIncludeAltArt)
            {
                count += statistics.Sum(stat => stat.AltArtNumber);
            }
            if (CountIncludeAltArt && CountIncludeFoil)
            {
                count += statistics.Sum(stat => stat.FoilAltArtNumber);
            }

            return(_countComparatorWanted == ComparisonType.GreaterOrEquals ? count >= CountSelected : count < CountSelected);
        }
Esempio n. 2
0
 private void ReInit()
 {
     //Default values
     Name = null;
     ExcludeFunEditions        = true;
     ExcludeOnlineOnlyEditions = true;
     ExcludeSpecialCards       = true;
     CountIncludeFoil          = false;
     CountIsNameBased          = false;
     CountComparatorSelected   = CountComparator[(int)ComparisonType.GreaterOrEquals];
     CountSelected             = 1;
     AllLanguages       = false;
     PerimeterScope     = PerimeterScope.All;
     ColorAggregation   = MultiSelectedAggregation.Or;
     TypeAggregation    = MultiSelectedAggregation.Or;
     SubTypeAggregation = MultiSelectedAggregation.Or;
     EditionsSelected.Clear();
     CollectionsSelected.Clear();
     ColorsSelected.Clear();
     TypesSelected.Clear();
     SubTypesSelected.Clear();
 }
Esempio n. 3
0
        internal void Reuse()
        {
            //Can be updated by application so refill the lists
            Result             = null;
            _idBlockFun        = _magicDatabase.GetAllBlocks().Where(b => b.Name.IndexOf("Fun", StringComparison.InvariantCultureIgnoreCase) >= 0).Select(b => b.Id).First();
            _idBlockOnlineOnly = _magicDatabase.GetAllBlocks().Where(b => b.Name.IndexOf("OnlineOnly", StringComparison.InvariantCultureIgnoreCase) >= 0).Select(b => b.Id).First();
            Editions           = _magicDatabase.GetAllEditionsOrdered();
            Collections        = _magicDatabase.GetAllCollections();

            IEdition[] editions = EditionsSelected.ToArray();

            foreach (IEdition edition in editions.Where(edition => !Editions.Contains(edition)))
            {
                EditionsSelected.Remove(edition);
            }

            ICardCollection[] collections = CollectionsSelected.ToArray();

            foreach (ICardCollection collection in collections.Where(collection => !Collections.Contains(collection)))
            {
                CollectionsSelected.Remove(collection);
            }
        }