BARS : Add export all option when right clicking audio folder.
This commit is contained in:
parent
c134a24765
commit
e66e16b3c4
@ -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<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user