Option to add new folders to IArchives

This commit is contained in:
KillzXGaming 2019-07-18 18:16:45 -04:00
parent 38af392160
commit 557fb17232

View file

@ -202,6 +202,9 @@ namespace Toolbox.Library
new STToolStripItem("Extract All", ExtractAllAction), new STToolStripItem("Extract All", ExtractAllAction),
new STToolStripSeparator(), new STToolStripSeparator(),
new STToolStripItem("Preview Archive", PreviewAction), new STToolStripItem("Preview Archive", PreviewAction),
new STToolStripSeparator(),
new STToolStripItem("Add Folder", AddFolderAction) { Enabled = ArchiveFile.CanAddFiles},
new STToolStripItem("Add File", AddFileAction) { Enabled = ArchiveFile.CanAddFiles},
}; };
var toolStripList = ToolStrips.ToList(); var toolStripList = ToolStrips.ToList();
@ -213,6 +216,23 @@ namespace Toolbox.Library
return toolStripList.ToArray(); return toolStripList.ToArray();
} }
private void AddFolderAction(object sender, EventArgs args)
{
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile));
}
private void AddFileAction(object sender, EventArgs args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Raw Data (*.*)|*.*";
ofd.Multiselect = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
TreeHelper.AddFiles(this, ArchiveFile, ofd.FileNames);
}
}
public void UpdateFileNames() public void UpdateFileNames()
{ {
if (!ArchiveFile.CanRenameFiles) if (!ArchiveFile.CanRenameFiles)
@ -508,10 +528,16 @@ namespace Toolbox.Library
new STToolStripItem("Replace Folder", ReplaceAction) { Enabled = ArchiveFile.CanReplaceFiles }, new STToolStripItem("Replace Folder", ReplaceAction) { Enabled = ArchiveFile.CanReplaceFiles },
new STToolStripItem("Delete Folder", DeleteAction) { Enabled = ArchiveFile.CanDeleteFiles }, new STToolStripItem("Delete Folder", DeleteAction) { Enabled = ArchiveFile.CanDeleteFiles },
new STToolStripSeparator(), new STToolStripSeparator(),
new STToolStripItem("Add Folder", AddFolderAction) { Enabled = ArchiveFile.CanAddFiles },
new STToolStripItem("Add File", AddFileAction) { Enabled = ArchiveFile.CanAddFiles }, new STToolStripItem("Add File", AddFileAction) { Enabled = ArchiveFile.CanAddFiles },
}; };
} }
private void AddFolderAction(object sender, EventArgs args)
{
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile));
}
private void AddFileAction(object sender, EventArgs args) private void AddFileAction(object sender, EventArgs args)
{ {
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();