diff --git a/File_Format_Library/FileFormats/Audio/BARS/BARS.cs b/File_Format_Library/FileFormats/Audio/BARS/BARS.cs index 2eed5809..0a081349 100644 --- a/File_Format_Library/FileFormats/Audio/BARS/BARS.cs +++ b/File_Format_Library/FileFormats/Audio/BARS/BARS.cs @@ -243,7 +243,7 @@ namespace FirstPlugin Nodes.Add("Meta Data"); if (bars.HasAudioFiles) - Nodes.Add("Audio"); + Nodes.Add(new AudioFolder("Audio")); for (int i = 0; i < bars.AudioEntries.Count; i++) { @@ -309,5 +309,30 @@ namespace FirstPlugin { bars.Save(stream); } + + public class AudioFolder : TreeNode, IContextMenuNode + { + public AudioFolder(string text) : base(text) + { + + } + + public ToolStripItem[] GetContextMenuItems() + { + List Items = new List(); + Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction, Keys.Control | Keys.E)); + return Items.ToArray(); + } + + private void ExportAllAction(object sender, EventArgs e) + { + FolderSelectDialog ofd = new FolderSelectDialog(); + if (ofd.ShowDialog() == DialogResult.OK) { + foreach (AudioEntry audio in Nodes) { + File.WriteAllBytes($"{ofd.SelectedPath}/{audio.Text}", audio.Data); + } + } + } + } } }