public void LoadDefault() { var DefQuery = from AudioDB.AudioFile aFile in aDB.AudioFileTable orderby aFile.trackName ascending select aFile; List<AudioDB.AudioFile> aFiles = new List<AudioDB.AudioFile>(DefQuery); allSongs = new Playlist(aFiles); }
public async Task LoadPlaylist(StorageFile file) { if(!(file.Name.EndsWith(".m3u") | file.Name.EndsWith(".m3u8"))) throw new Exception("Invalid playlist file"); IList<string> contents = await Windows.Storage.FileIO.ReadLinesAsync(file); List<AudioDB.AudioFile> lPlaylist = new List<AudioDB.AudioFile>(); foreach (string entry in contents) { if(entry.StartsWith("#")) continue; var entryQuery = from AudioDB.AudioFile aFile in aDB.AudioFileTable where aFile.fileName == System.IO.Path.GetFileName(entry) select aFile; List<AudioDB.AudioFile> entryList = new List<AudioDB.AudioFile>(entryQuery); foreach (AudioDB.AudioFile entryFile in entryList) { lPlaylist.Add(entryFile); } } instance = new Playlist(lPlaylist); }
public void ClearPlaylist() { instance = null; }