1
0
mirror of synced 2025-01-19 17:18:44 +01:00

BARS : Add export all option when right clicking audio folder.

This commit is contained in:
KillzXGaming 2020-06-12 18:59:17 -04:00
parent c134a24765
commit e66e16b3c4

View File

@ -243,7 +243,7 @@ namespace FirstPlugin
Nodes.Add("Meta Data"); Nodes.Add("Meta Data");
if (bars.HasAudioFiles) if (bars.HasAudioFiles)
Nodes.Add("Audio"); Nodes.Add(new AudioFolder("Audio"));
for (int i = 0; i < bars.AudioEntries.Count; i++) for (int i = 0; i < bars.AudioEntries.Count; i++)
{ {
@ -309,5 +309,30 @@ namespace FirstPlugin
{ {
bars.Save(stream); bars.Save(stream);
} }
public class AudioFolder : TreeNode, IContextMenuNode
{
public AudioFolder(string text) : base(text)
{
}
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
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);
}
}
}
}
} }
} }