コード例 #1
0
        public async Task SavePlaylist(Playlist list)
        {
            if (list == null) return;

            await ClearPlaylist();

            list.ModifiedDate = DateTime.Now;
            
            using (var file = new StreamWriter(await _storageService.CreateFileAsync(_playlistFile)))
            {
                var json = JsonConvert.SerializeObject(list);

                file.Write(json);
            }
        }
コード例 #2
0
        public void SavePlaylist(Playlist list)
        {
            if (list == null) return;

            ClearPlaylist();

            list.ModifiedDate = DateTime.Now;
            
            using (var file = new StreamWriter(_storageService.OpenFile(_playlistFile, FileMode.OpenOrCreate, FileAccess.ReadWrite)))
            {
                var json = JsonConvert.SerializeObject(list);

                file.Write(json);
            }
        }
コード例 #3
0
        public async Task ResetTrackNumbers(Playlist playlist)
        {
            if (playlist == null) return;

            var i = 1;
            foreach (var item in playlist.PlaylistItems)
            {
                if (item.IsJustAdded)
                {
                    item.IsJustAdded = false;
                    item.OriginalId = i;
                }
                item.Id = i;
                i++;
            }

            await SavePlaylist(playlist);
        }