public static BeatSaberPlaylistsLib.Types.IPlaylist CreateNew(string playlistName, IPreviewBeatmapLevel[] beatmapLevels) { string playlistFolderPath = defaultManager.PlaylistPath; string playlistFileName = string.Join("_", playlistName.Replace("/", "").Replace("\\", "").Replace(".", "").Split(' ')); if (string.IsNullOrEmpty(playlistFileName)) { playlistFileName = "playlist"; } string playlistPath = Path.Combine(playlistFolderPath, playlistFileName + ".blist"); string originalPlaylistPath = Path.Combine(playlistFolderPath, playlistFileName); int dupNum = 0; while (File.Exists(playlistPath)) { dupNum++; playlistPath = originalPlaylistPath + string.Format("({0}).blist", dupNum); playlistFileName += string.Format("({0})", dupNum); } BeatSaberPlaylistsLib.Types.IPlaylist playlist = defaultManager.CreatePlaylist(playlistFileName, playlistName, "SongBrowser", ""); foreach (var beatmapLevel in beatmapLevels) { playlist.Add(beatmapLevel); } defaultManager.StorePlaylist(playlist); playlist.SuggestedExtension = defaultManager.DefaultHandler?.DefaultExtension; return(playlist); }
internal void ShowModal(BeatSaberPlaylistsLib.Types.IPlaylist playlist) { Parse(); parserParams.EmitEvent("close-modal"); parserParams.EmitEvent("open-modal"); ShowImages(playlist); }
private void ShowImages(BeatSaberPlaylistsLib.Types.IPlaylist playlist) { customListTableData.data.Clear(); // Add clear image customListTableData.data.Add(new CustomCellInfo("Clear Icon", "Clear", PlaylistLibUtils.GeneratePlaylistIcon(playlist))); // Add default image customListTableData.data.Add(new CustomCellInfo("PlaylistManager Icon", "Default", playlistManagerIcon)); LoadImages(); foreach (var coverImage in coverImages) { if (!coverImage.Value.SpriteWasLoaded && !coverImage.Value.Blacklist) { coverImage.Value.SpriteLoaded += CoverImage_SpriteLoaded; _ = coverImage.Value.Sprite; } else if (coverImage.Value.SpriteWasLoaded) { customListTableData.data.Add(new CustomCellInfo(Path.GetFileName(coverImage.Key), coverImage.Key, coverImage.Value.Sprite)); } } customListTableData.tableView.ReloadData(); customListTableData.tableView.ScrollToCellWithIdx(0, TableView.ScrollPositionType.Beginning, false); _ = ViewControllerMonkeyCleanup(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UpButtonEnabled))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownButtonEnabled))); }
private void Save(BeatSaberPlaylistsLib.Types.IPlaylist playlists) { if (playlists == null) { return; } PlaylistLibUtility.CurrentManager.StorePlaylist(playlists); }
public static BeatSaberPlaylistsLib.Types.IPlaylist CreateNew(string playlistName, IReadOnlyList <IPreviewBeatmapLevel> beatmapLevels) { BeatSaberPlaylistsLib.Types.IPlaylist playlist = defaultManager.CreatePlaylist("", playlistName, "SongBrowser", ""); foreach (var beatmapLevel in beatmapLevels) { playlist.Add(beatmapLevel); } defaultManager.StorePlaylist(playlist); return(playlist); }
public void SetCurrentPlaylist(BeatSaberPlaylistsLib.Types.IPlaylist playlist) { this.CurrentPlaylist = playlist; if (playlist == null) { this._editView.Title = ""; this._editView.Author = ""; this._editView.Description = ""; return; } else { this._editView.Title = playlist.Title; this._editView.Author = playlist.Author; this._editView.Description = playlist.Description; } }
public static void CreatePlaylist(string playlistName, string playlistAuthorName, string image) { string playlistFolderPath = Path.Combine(Environment.CurrentDirectory, "Playlists"); string playlistFileName = String.Join("_", playlistName.Split(' ')); string playlistPath = Path.Combine(playlistFolderPath, playlistFileName + ".blist"); string originalPlaylistPath = Path.Combine(playlistFolderPath, playlistFileName); int dupNum = 0; while (File.Exists(playlistPath)) { dupNum++; playlistPath = originalPlaylistPath + string.Format("({0}).blist", dupNum); playlistFileName = playlistFileName + string.Format("({0})", dupNum); } BeatSaberPlaylistsLib.Types.IPlaylist playlist = playlistManager.CreatePlaylist(playlistFileName, playlistName, playlistAuthorName, image); playlist.AllowDuplicates = true; playlistManager.StorePlaylist(playlist); }
public async Task SavePlaylist(BeatSaberPlaylistsLib.Types.IPlaylist playlist) { if (string.IsNullOrEmpty(playlist.Filename)) { playlist.Filename = $"{playlist.Title}_{DateTime.Now:yyyyMMddHHmmss}"; } var start = new Stopwatch(); start.Start(); await Task.Run(() => { Logger.Info($"Filename : {playlist.Filename}"); PlaylistLibUtility.CurrentManager.StorePlaylist(playlist); }); start.Stop(); Logger.Info($"Save time : {start.ElapsedMilliseconds}ms"); }
private void AnnotatedBeatmapLevelCollectionsViewController_didSelectAnnotatedBeatmapLevelCollectionEvent(IAnnotatedBeatmapLevelCollection annotatedBeatmapLevelCollection) { if (annotatedBeatmapLevelCollection is BeatSaberPlaylistsLib.Types.IPlaylist selectedPlaylist) { Events.RaisePlaylistSelected(selectedPlaylist, parentManager); this.selectedPlaylist = selectedPlaylist; parentManager = PlaylistLibUtils.playlistManager.GetManagerForPlaylist(selectedPlaylist); } else { this.selectedPlaylist = null; parentManager = null; } foreach (ILevelCollectionUpdater levelCollectionUpdater in levelCollectionUpdaters) { levelCollectionUpdater.LevelCollectionUpdated(annotatedBeatmapLevelCollection, parentManager); } }
public CustomPlaylist(BeatSaberPlaylistsLib.Types.IPlaylist playlist) { _playlist = playlist; }
internal static void RaisePlaylistSelected(BeatSaberPlaylistsLib.Types.IPlaylist playlist, BeatSaberPlaylistsLib.PlaylistManager parentManager) => playlistSelected?.Invoke(playlist, parentManager);
public void ShowEdit() { Logger.Info("ShowEditView"); this._editView.CurrentPlaylist = this.CurrentPlaylist; this.ReplaceTopViewController(this._editView, null, ViewController.AnimationType.Out, ViewController.AnimationDirection.Vertical); }