mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
Add quick batch file table option
This commit is contained in:
parent
5e61cf3bee
commit
0d0ad3c461
3 changed files with 51 additions and 2 deletions
|
@ -238,6 +238,36 @@ namespace Toolbox.Library.IO
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void BatchFileTable(string directory)
|
||||||
|
{
|
||||||
|
foreach (var file in Directory.GetDirectories(directory))
|
||||||
|
BatchFileTable(file);
|
||||||
|
|
||||||
|
foreach (var file in Directory.GetFiles(directory))
|
||||||
|
{
|
||||||
|
var fileStream = File.OpenRead(file);
|
||||||
|
uint compLength = (uint)fileStream.Length;
|
||||||
|
uint decompLength = (uint)fileStream.Length;
|
||||||
|
bool yaz0 = false;
|
||||||
|
foreach (ICompressionFormat compressionFormat in FileManager.GetCompressionFormats())
|
||||||
|
{
|
||||||
|
fileStream.Position = 0;
|
||||||
|
if (compressionFormat.Identify(fileStream, file))
|
||||||
|
{
|
||||||
|
fileStream.Position = 0;
|
||||||
|
if (compressionFormat is Yaz0)
|
||||||
|
yaz0 = true;
|
||||||
|
|
||||||
|
var decomp = compressionFormat.Decompress(fileStream);
|
||||||
|
decompLength = (uint)decomp.Length;
|
||||||
|
decomp.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SatisfyFileTables(null, file, File.OpenRead(file), compLength, decompLength, yaz0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Stream CompressFileFormat(ICompressionFormat compressionFormat, Stream data, bool FileIsCompressed, int Alignment,
|
private static Stream CompressFileFormat(ICompressionFormat compressionFormat, Stream data, bool FileIsCompressed, int Alignment,
|
||||||
string FileName, bool EnableDialog = true)
|
string FileName, bool EnableDialog = true)
|
||||||
{
|
{
|
||||||
|
|
14
Toolbox/MainForm.Designer.cs
generated
14
Toolbox/MainForm.Designer.cs
generated
|
@ -71,6 +71,7 @@
|
||||||
this.stToolStrip1 = new Toolbox.Library.Forms.STToolStrip();
|
this.stToolStrip1 = new Toolbox.Library.Forms.STToolStrip();
|
||||||
this.saveToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.saveToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
this.updateToolstrip = new System.Windows.Forms.ToolStripButton();
|
this.updateToolstrip = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.batchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.stPanel1.SuspendLayout();
|
this.stPanel1.SuspendLayout();
|
||||||
this.tabControlContextMenuStrip.SuspendLayout();
|
this.tabControlContextMenuStrip.SuspendLayout();
|
||||||
|
@ -180,7 +181,8 @@
|
||||||
// toolsToolStripMenuItem
|
// toolsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.compressionToolStripMenuItem});
|
this.compressionToolStripMenuItem,
|
||||||
|
this.batchToolStripMenuItem});
|
||||||
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
||||||
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 21);
|
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 21);
|
||||||
this.toolsToolStripMenuItem.Text = "Tools";
|
this.toolsToolStripMenuItem.Text = "Tools";
|
||||||
|
@ -188,7 +190,7 @@
|
||||||
// compressionToolStripMenuItem
|
// compressionToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.compressionToolStripMenuItem.Name = "compressionToolStripMenuItem";
|
this.compressionToolStripMenuItem.Name = "compressionToolStripMenuItem";
|
||||||
this.compressionToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
this.compressionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.compressionToolStripMenuItem.Text = "Compression";
|
this.compressionToolStripMenuItem.Text = "Compression";
|
||||||
//
|
//
|
||||||
// experimentalToolStripMenuItem
|
// experimentalToolStripMenuItem
|
||||||
|
@ -452,6 +454,13 @@
|
||||||
this.updateToolstrip.ToolTipText = "Update Tool";
|
this.updateToolstrip.ToolTipText = "Update Tool";
|
||||||
this.updateToolstrip.Click += new System.EventHandler(this.updateToolstrip_Click);
|
this.updateToolstrip.Click += new System.EventHandler(this.updateToolstrip_Click);
|
||||||
//
|
//
|
||||||
|
// batchToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.batchToolStripMenuItem.Name = "batchToolStripMenuItem";
|
||||||
|
this.batchToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.batchToolStripMenuItem.Text = "Batch Set File Table";
|
||||||
|
this.batchToolStripMenuItem.Click += new System.EventHandler(this.batchToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
|
@ -530,5 +539,6 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem githubToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem githubToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tutorialToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem tutorialToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem openFolderToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem openFolderToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem batchToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1333,5 +1333,14 @@ namespace Toolbox
|
||||||
|
|
||||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
|
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void batchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FolderSelectDialog folderDlg = new FolderSelectDialog();
|
||||||
|
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
STFileSaver.BatchFileTable(folderDlg.SelectedPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue