public CurrentPlaylist() { this._playlist = new Model.Playlist(); this._sortPlaylistsFuncs["Title"] = sortByTitle; this._sortPlaylistsFuncs["File Size"] = sortBySize; this._sortPlaylistsFuncs["Time"] = sortByTime; this._sortPlaylistsFuncs["Genre"] = sortByGenre; this._sortPlaylistsFuncs["Type"] = sortByType; }
public static void save(Playlist toSave) { using (FileStream fs = new FileStream(toSave.path, FileMode.Create)) { //toSave.setSavablePlaylist(); XmlSerializer serializer = new XmlSerializer(typeof(Model.Playlist)); serializer.Serialize(fs, toSave); } }
public static async Task SaveToCache(string path, Playlist playlist) { StorageFile file = null; bool isFileExists = false; try { file = await LocalCacheFolder.GetFileAsync(path); isFileExists = (file != null); } catch { isFileExists = false; } if (isFileExists == false) { file = await LocalCacheFolder.CreateFileAsync(path); } Stream stream = await file.OpenStreamForWriteAsync(); using (XmlWriter wr = XmlWriter.Create(stream)) // using sẽ tự dispose { wr.WriteStartDocument(); wr.WriteStartElement("Playlist"); { wr.WriteElementString("CurrentIndex", playlist.CurrentIndex.ToString()); wr.WriteStartElement("List"); { foreach (var fileitem in playlist.ListFile) { wr.WriteElementString("Path", fileitem.File.Path); } } wr.WriteEndElement(); } wr.WriteEndElement(); wr.WriteEndDocument(); } }
public CurrentPlaylist(CurrentPlaylist o) { this._playlist = o._playlist; }
public void selectPlaylist(Playlist pls) { PlaylistManager.save(pls); this._playlist = pls; this.resetPlayList(); }
private void loadPlaylist(string path) { Playlist pls; path = path.Replace("\\", "/"); try { pls = PlaylistManager.load(path); } catch { pls = new Playlist(path); PlaylistManager.save(pls); } this._playlists.Add(path, pls); }
public void fillLibrary(List<Playlist> list) { Playlist audio = new Playlist(); Playlist video = new Playlist(); Playlist image = new Playlist(); foreach (Playlist pl in list) { foreach (IMedia m in pl.getPlayList()) { if (m.Type == mediaType.AUDIO) audio.add(m); else if (m.Type == mediaType.VIDEO) video.add(m); else if (m.Type == mediaType.IMAGE) image.add(m); } } }