Beispiel #1
0
        public static void Save(int playlistID)
        {
            CPlaylistFile pl = Get(playlistID);

            if (pl != null)
            {
                pl.Save();
            }
        }
Beispiel #2
0
        private static void _ConvertUSDXPlaylists()
        {
            var files = new List <string>();

            files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), "*.upl", true, true));

            foreach (string file in files)
            {
                CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
                playlist.Save();
                _Playlists.Add(playlist);
            }
        }
Beispiel #3
0
        public static void RemoveSongFromPlaylist(int position, int playlistId, int songId)
        {
            CPlaylistFile pl = CPlaylists.Get(playlistId);

            if (pl == null)
            {
                throw new ArgumentException("invalid playlistId");
            }
            if (!PlaylistContainsSong(songId, playlistId))
            {
                throw new ArgumentException("invalid songId");
            }
            if (position < 0 || pl.Songs.Count <= position ||
                pl.Songs[position].SongID != songId)
            {
                throw new ArgumentException("invalid position");
            }
            pl.DeleteSong(position);
            pl.Save();
        }
Beispiel #4
0
        public static void MoveSongInPlaylist(int newPosition, int playlistId, int songId)
        {
            CPlaylistFile pl = CPlaylists.Get(playlistId);

            if (pl == null)
            {
                throw new ArgumentException("invalid playlistId");
            }
            if (!PlaylistContainsSong(songId, playlistId))
            {
                throw new ArgumentException("invalid songId");
            }

            if (pl.Songs.Count < newPosition)
            {
                throw new ArgumentException("invalid newPosition");
            }

            int oldPosition = pl.Songs.FindIndex(s => s.SongID == songId);

            pl.MoveSong(oldPosition, newPosition);
            pl.Save();
        }