예제 #1
0
 private void DeleteButtonPressed()
 {
     try
     {
         if (popupModalsController.CheckboxValue)
         {
             DeleteSongs();
         }
         DeletePlaylist();
     }
     catch (Exception e)
     {
         popupModalsController.ShowOkModal(rootTransform, "Error: Playlist cannot be deleted.", null);
         Plugin.Log.Critical(string.Format("An exception was thrown while deleting a playlist.\nException message:{0}", e));
     }
 }
        private void CreateKeyboardEnter(string folderName)
        {
            folderName = folderName.Replace("/", "").Replace("\\", "").Replace(".", "");
            if (!string.IsNullOrEmpty(folderName))
            {
                BeatSaberPlaylistsLib.PlaylistManager childManager = currentParentManager.CreateChildManager(folderName);

                if (currentManagers.Contains(childManager))
                {
                    popupModalsController.ShowOkModal(levelSelectionNavigationController.transform, "\"" + folderName + "\" already exists! Please use a different name.", null);
                }
                else
                {
                    CustomListTableData.CustomCellInfo customCellInfo = new CustomListTableData.CustomCellInfo(folderName, icon: PlaylistLibUtils.DrawFolderIcon(folderName));
                    customListTableData.data.Add(customCellInfo);
                    customListTableData.tableView.ReloadData();
                    customListTableData.tableView.ClearSelection();
                    currentManagers.Add(childManager);
                }
            }
        }
 private void ChangeImage()
 {
     if (selectedIndex == 0)
     {
         ImageSelectedEvent?.Invoke(null);
         parserParams.EmitEvent("close-modal");
     }
     else if (selectedIndex == 1)
     {
         using (Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PlaylistManager.Icons.Logo.png"))
         {
             byte[] imageBytes = new byte[imageStream.Length];
             imageStream.Read(imageBytes, 0, (int)imageStream.Length);
             ImageSelectedEvent?.Invoke(imageBytes);
             parserParams.EmitEvent("close-modal");
         }
     }
     else
     {
         string selectedImagePath = customListTableData.data[selectedIndex].subtext;
         try
         {
             using (FileStream imageStream = File.Open(selectedImagePath, FileMode.Open))
             {
                 byte[] imageBytes = new byte[imageStream.Length];
                 imageStream.Read(imageBytes, 0, (int)imageStream.Length);
                 ImageSelectedEvent?.Invoke(imageBytes);
                 parserParams.EmitEvent("close-modal");
             }
         }
         catch (Exception e)
         {
             popupModalsController.ShowOkModal(modalTransform, "There was an error loading this image. Check logs for more details.", null, animateParentCanvas: false);
             Plugin.Log.Critical("Could not load " + selectedImagePath + "\nException message: " + e.Message);
         }
     }
 }