public void AddTracksToPlaylist(List <Paths> tracks)
 {
     using (IXmlParsable parser = new JsonPlaylistParser(PlaylistPath, _playlistName + extention))
     {
         parser.AddItems(tracks);
     }
 }
Beispiel #2
0
        public List <Track> Load(bool append, bool restore = false)
        {
            string path = InternalStorageHelper.InternalPlaylistAllLocation;

            System.IO.Directory.CreateDirectory(path);
            using (IXmlParsable parser = new JsonPlaylistParser(path, "All.json"))
            {
                List <Track> tracks = null;
                if (!append)
                {
                    tracks = JsonCacheParser.Read();
                }
                if (tracks == null)
                {
                    List <Paths> songs = SearchForSongs();
                    if (restore)
                    {
                        if (System.IO.File.Exists(Path.Combine(path, "All.json")))
                        {
                            File.Delete(Path.Combine(path, "All.json"));
                        }
                    }
                    parser.AddItems(songs);
                    tracks = TrackFinder.ConvertPathsToTracks(songs);
                    CacheSongs(tracks);
                }

                return(tracks);
            }
        }