Example #1
0
        private static IShuffleCollection GetShuffleCollection(ShuffleType type, ISongCollection songs, string xmlText)
        {
            IShuffleCollection shuffle;

            switch (type)
            {
            case ShuffleType.Off:
                shuffle = new ShuffleOffCollection(songs);
                break;

            case ShuffleType.OneTime:
                shuffle = new ShuffleOneTimeCollection(songs);
                break;

            case ShuffleType.Path:
                shuffle = new ShufflePathCollection(songs);
                break;

            case ShuffleType.Complete:
                shuffle = new ShuffleCompleteCollection(songs);
                break;

            default:
                throw new NotImplementedException();
            }

            shuffle.ReadXml(XmlConverter.GetReader(xmlText));

            return(shuffle);
        }
Example #2
0
        public void SetShuffleType(ShuffleType type)
        {
            if (type == Shuffle.Type)
            {
                return;
            }

            Shuffle = CreateShuffle(type, Parent?.CurrentSong);
        }
Example #3
0
        public SongCollection(IEnumerable <Song> songs, ShuffleType type, Song currentSong)
        {
            list = new List <Song>(songs);

            foreach (Song song in list)
            {
                song.Parent = this;
            }

            Shuffle = CreateShuffle(type, currentSong);
        }
        //  Added to make old code compile
        public Deck(int size, ShuffleType shuffleType)
        {
            //  Setup the cardCOunter object
            this.cardCounter = new CardCounting(new BlackJackGameParams());

            this.DeckList = new List <Card>();
            for (int x = 0; x < size; x++)
            {
                fillWith52Cards();
            }

            this.DeckList_Backup = new List <Card>();
            this.shuffleType     = shuffleType;
        }
        public Deck(int size, ShuffleType shuffleType, CardCounting cardCounter)
        {
            //  Setup the cardCOunter object
            this.cardCounter = cardCounter;

            this.DeckList = new List <Card>();
            for (int x = 0; x < size; x++)
            {
                fillWith52Cards();
            }

            this.DeckList_Backup = new List <Card>();
            this.shuffleType     = shuffleType;
        }
Example #6
0
        public void ReadXml(XmlReader reader)
        {
            ShuffleType shuffleType = (ShuffleType)Enum.Parse(typeof(ShuffleType), reader.GetAttribute("Shuffle"));

            reader.ReadStartElement();
            list = new List <Song>(XmlConverter.DeserializeList <Song>(reader, "Song"));

            foreach (Song song in list)
            {
                song.Parent = this;
            }

            Shuffle = new SimpleShuffleCollection(this, shuffleType);
        }
Example #7
0
        private void ReceiveShufflePropertyChanged(ValueSet valueSet, string value)
        {
            ShuffleType shuffle      = (ShuffleType)Enum.Parse(typeof(ShuffleType), value);
            string      shuffleXml   = valueSet[shuffleKey].ToString();
            string      playlistPath = valueSet[playlistPathKey].ToString();

            IPlaylist changedPlaylist;

            if (!HavePlaylist(playlistPath, out changedPlaylist))
            {
                return;
            }

            changedPlaylist.Songs.Shuffle = GetShuffleCollection(shuffle, changedPlaylist.Songs, shuffleXml);
        }
Example #8
0
        public void ReadXml(XmlReader reader)
        {
            ShuffleType shuffleType = (ShuffleType)Enum.Parse(typeof(ShuffleType),
                                                              reader.GetAttribute("Shuffle") ?? Enum.GetName(typeof(ShuffleType), ShuffleType.Off));
            IShuffleCollection shuffle = GetShuffleType(shuffleType);

            reader.ReadStartElement();
            list = XmlConverter.DeserializeList <Song>(reader, "Song").ToList();

            foreach (Song song in list)
            {
                song.Parent = this;
            }

            shuffle.ReadXml(XmlConverter.GetReader(reader.ReadOuterXml()));
            Shuffle = shuffle;
        }
Example #9
0
        private IShuffleCollection GetShuffleType(ShuffleType type)
        {
            switch (type)
            {
            case ShuffleType.Complete:
                return(new ShuffleCompleteCollection(this));

            case ShuffleType.Off:
                return(new ShuffleOffCollection(this));

            case ShuffleType.OneTime:
                return(new ShuffleOneTimeCollection(this));

            case ShuffleType.Path:
                return(new ShufflePathCollection(this));
            }

            throw new NotImplementedException("Value \"" + type + "\"of LoopType is not implemented in GetShuffleType");
        }
Example #10
0
        public ShuffleMachine(int Decks, ShuffleType shuffleType, string type = "BACKJACK")
        {
            this.shuffleType = shuffleType;
            machineType      = type;
            if (Decks <= 0)
            {
                numOfDecks = 1;
            }
            else
            {
                numOfDecks = Decks;
            }

            for (int i = 0; i < numOfDecks; i++)
            {
                Deck newDeck = new Deck();
                cards.AddRange(newDeck.GetCards());
            }
        }
Example #11
0
        private IShuffleCollection CreateShuffle(ShuffleType type, Song currentSong)
        {
            MobileDebug.Service.WriteEvent("CreateShuffle1", type, currentSong);
            switch (type)
            {
            case ShuffleType.Complete:
                return(new ShuffleCompleteCollection(this, currentSong));

            case ShuffleType.Off:
                return(new ShuffleOffCollection(this));

            case ShuffleType.OneTime:
                return(new ShuffleOneTimeCollection(this, currentSong));

            case ShuffleType.Path:
                return(new ShufflePathCollection(this));
            }

            throw new NotImplementedException("Value \"" + type + "\"of LoopType is not implemented in CreateShuffle");
        }
Example #12
0
        public void ReadXml(XmlReader reader)
        {
            double currentSongPosition = double.Parse(reader.GetAttribute("CurrentSongPosition") ?? "0");

            AbsolutePath = reader.GetAttribute("AbsolutePath") ?? emptyOrLoadingPath;
            Name         = reader.GetAttribute("Name") ?? emptyName;
            Loop         = (LoopType)Enum.Parse(typeof(LoopType), reader.GetAttribute("Loop") ?? LoopType.Off.ToString());

            string      currentSongPath = reader.GetAttribute("CurrentSongPath") ?? string.Empty;;
            ShuffleType shuffle         = (ShuffleType)Enum.Parse(typeof(ShuffleType),
                                                                  reader.GetAttribute("Shuffle") ?? ShuffleType.Off.ToString());

            reader.ReadStartElement();

            ISongCollection songs = reader.Name == typeof(SongCollection).Name ?
                                    (ISongCollection) new SongCollection() : new SimpleSongCollection();

            songs.Parent = this;
            Songs        = XmlConverter.Deserialize(songs, reader.ReadOuterXml());

            CurrentSong         = songs.FirstOrDefault(s => s.Path == currentSongPath) ?? songs.FirstOrDefault();
            CurrentSongPosition = currentSongPosition;
        }
Example #13
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="wordType">тип слов, которые мешаем</param>
 /// <param name="shuffleType">тип данных, которые мешаем</param>
 public ShuffleWordsQuery(WordType wordType, ShuffleType shuffleType)
 {
     _shuffleType = (int)shuffleType;
     _wordType    = (int)wordType;
 }
Example #14
0
 public void SetShuffleType(ShuffleType type)
 {
     Shuffle = new SimpleShuffleCollection(this, type);
 }
Example #15
0
 public static void SetShuffle(this Client c, ShuffleType type)
 {
     c.SendCommand("playback", "setShuffle", type.ToString());
 }
Example #16
0
 private void machineShuffeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     shuffleType = ShuffleType.Machine;
     handShuffeToolStripMenuItem.Checked = false;
     countingBox.Visible = false;
 }
 public SimpleShuffleCollection(ISongCollection parent, ShuffleType type)
 {
     Parent = parent;
     Type   = type;
 }