Example #1
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;
        }