コード例 #1
0
        private int PrivateHowManySongs(BasicSection thisS, int songCount)
        {
            int temps = songCount.MultiplyPercentage(thisS.Percent);

            if (thisS.HowManySongs == 0)
            {
                thisS.ChooseAll = true;
            }

            if (thisS.ChooseAll == true)
            {
                if (thisS.Percent == 0)
                {
                    return(songCount);
                }

                return(temps);
            }
            if (thisS.HowManySongs > temps)
            {
                return(temps);
            }

            return(thisS.HowManySongs);
        }
コード例 #2
0
        public async Task AddSectionAsync(BasicSection thisSection) //now can be all async since the console supports async.
        {
            await Task.Run(() =>
            {
                _alreadyHad   = true;
                var firstList = thisSection.SongList !.ToCustomBasicList();
                if (firstList.Count == 0)
                {
                    throw new BasicBlankException("When getting custom list, can't have 0 songs");
                }

                _pList           = new CustomBasicList <IBaseSong>();
                var howManySongs = PrivateHowManySongs(thisSection, firstList.Count);
                if (howManySongs == 0)
                {
                    throw new BasicBlankException("PrivateHowManySongs Can't Return 0 Songs");
                }

                firstList.ShuffleList(howManySongs); //i think
                if (firstList.Count == 0)
                {
                    throw new BasicBlankException("Can't have 0 songs after shuffling.  Rethink");
                }

                firstList.ForEach(items =>
                {
                    SongsChosen.Add(items.ID); //i think
                });
                _pList = firstList;
                _rList.AddRange(firstList);
            });
        }