예제 #1
0
        public void ReShuffle()
        {
            var rnd = new Random((int)DateTime.Now.Ticks);
            ArrayList pc = FileCore.GetPlayListContent(_playListName, true);
            for (var i = 0; i < _playListEntries.Length; i++)
            {
                _playListEntries[i] = null;
            }

            foreach (PlayListContent pcEntry in pc)
            {
                int entry;
                do
                {
                    entry = rnd.Next(pc.Count);
                } while (_playListEntries[entry] != null);

                _playListEntries[entry] = new PlayListEntry(pcEntry.FileName, pcEntry.Pause);
            }
            _index = 0;
        }
예제 #2
0
        public CurrentPlayList(string playListFileName, bool shuffle)
        {
            _playListName = playListFileName;

            int entry = 0;
            var rnd = new Random((int)DateTime.Now.Ticks);

            ArrayList pc = FileCore.GetPlayListContent(playListFileName, true);

            if (shuffle)
            {
                entry = rnd.Next();
            }

            _playListEntries = new PlayListEntry[pc.Count];

            foreach (PlayListContent pcEntry in pc)
            {
                if (shuffle)
                {
                    do
                    {
                        entry = rnd.Next(pc.Count);
                    } while (_playListEntries[entry] != null);

                    _playListEntries[entry] = new PlayListEntry(pcEntry.FileName, pcEntry.Pause);
                }
                else
                {
                    _playListEntries[entry++] = new PlayListEntry(pcEntry.FileName, pcEntry.Pause);
                }
            }
        }