public static void RemoveLevelFromPlaylist(Playlist playlist, string hash) { if (playlist.songs.Any(x => x.hash == hash)) { PlaylistSong song = playlist.songs.First(x => x.hash == hash); song.level = null; playlist.songs.Remove(song); } playlist.SavePlaylist(); //Update Playlist Pack }
public static void AddLevelToPlaylist(Playlist playlist, CustomPreviewBeatmapLevel level) { string hash = SongCore.Utilities.Hashing.GetCustomLevelHash(level); if (playlist.songs.Any(x => string.Equals(x.hash, hash, StringComparison.OrdinalIgnoreCase))) { return; } PlaylistSong song = new PlaylistSong(); song.hash = hash; song.level = level; song.levelId = level.levelID; song.songName = level.songName + " - " + level.levelAuthorName; playlist.songs.Add(song); playlist.SavePlaylist(); }