public List <Track> FetchTracksFromPlaylist()
 {
     using (IXmlParsable parser = new JsonPlaylistParser(PlaylistPath, _playlistName + extention))
     {
         return(Track_Finder.TrackFinder.ConvertPathsToTracks((List <Paths>)parser.FetchItems()));
     }
 }
예제 #2
0
        private void InitList()
        {
            ISharedPreferences p = this.GetSharedPreferences(Startup.Prefs, FileCreationMode.Private);

            if (p.GetBoolean(Startup.REMEMBER, true))
            {
                ServiceSharedPref prefs    = new ServiceSharedPref(this);
                string            pullfrom = prefs.PullDataFrom();
                if (pullfrom == ServiceSharedPref.PULLDATAFROM_ALLTRACKS)
                {
                    using (IXmlParsable parser = new JsonPlaylistParser(InternalStorageHelper.InternalPlaylistAllLocation, "All.json"))
                    {
                        tracks = (List <Paths>)parser.FetchItems();
                    }
                }
                else if (pullfrom == ServiceSharedPref.PULLDATAFROM_FOLDER)
                {
                    string folderName = prefs.PullDataPath();
                    tracks = Track_Finder.TrackFinder.GetSongsFromFolder(folderName);
                }
                else
                {
                    string playlistName = prefs.PullDataPath();
                    Playlist_Manager.PlaylistManager manager = new Playlist_Manager.PlaylistManager(playlistName);
                    tracks = Track_Finder.TrackFinder.ConvertToPaths(manager.FetchTracksFromPlaylist());
                }
                song = prefs.PullLastSong();
            }
            else
            {
                if (p.GetString(Startup.VIEWMETHOD, Startup.ALLTRACKS) == Startup.PLAYLIST)
                {
                    string playlistName = p.GetString(Startup.PLAYLISTNAME, string.Empty);
                    Playlist_Manager.PlaylistManager manager = new Playlist_Manager.PlaylistManager(playlistName);
                    tracks = Track_Finder.TrackFinder.ConvertToPaths(manager.FetchTracksFromPlaylist());
                }
                else
                {
                    using (IXmlParsable parser = new JsonPlaylistParser(InternalStorageHelper.InternalPlaylistAllLocation, "All.json"))
                    {
                        tracks = (List <Paths>)parser.FetchItems();
                    }
                }
            }
        }