コード例 #1
0
        public void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();

            list = XmlConverter.DeserializeList <Playlist>(reader).Cast <IPlaylist>().ToList();

            foreach (IPlaylist playlist in list)
            {
                playlist.Parent = this;
            }
        }
コード例 #2
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);
        }
コード例 #3
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;
        }
コード例 #4
0
        private void ReceivePlaylistsCollectionChanged(ValueSet valueSet, string value)
        {
            string removeXml = valueSet[removeKey].ToString();
            string addXml    = valueSet[addKey].ToString();

            string[]   removePaths = XmlConverter.Deserialize <string[]>(removeXml);
            Playlist[] adds        = XmlConverter.DeserializeList <Playlist>(addXml).ToArray();

            List <IPlaylist> removes = new List <IPlaylist>();

            foreach (string path in removePaths)
            {
                IPlaylist playlist;

                if (HavePlaylist(path, out playlist))
                {
                    removes.Add(playlist);
                }
            }

            library.Playlists.Change(removes, adds);
        }