public void ReadXml(XmlReader reader) { reader.ReadStartElement(); list = XmlConverter.DeserializeList <Playlist>(reader).Cast <IPlaylist>().ToList(); foreach (IPlaylist playlist in list) { playlist.Parent = this; } }
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); }
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; }
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); }