1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Adjustments for limiting the size

This commit is contained in:
KillzXGaming 2019-06-17 19:37:40 -04:00
parent b8aad096ff
commit 99883c9a5b
7 changed files with 42 additions and 52 deletions

Binary file not shown.

View File

@ -55,9 +55,6 @@ namespace FirstPlugin
byte[] DecompressedBlock;
SDFTOC_ID endId;
//Temp but just for now as this is expeirmental. Need to optmize tree loading
private readonly int MAX_FILE_DISPLAY = 4000;
//Thanks to https://github.com/GoldFarmer/rouge_sdf/blob/master/main.cpp for docs/structs
public void Load(System.IO.Stream stream)
{
@ -110,7 +107,6 @@ namespace FirstPlugin
MessageBox.Show("Note! Support for this format is experimental. The tool will only load < 4000 files atm due to slow loading");
for (int i = 0; i < FileEntries.Count; i++)
if (i < MAX_FILE_DISPLAY)
files.Add(FileEntries[i]);
}
}

View File

@ -32,25 +32,20 @@ namespace Switch_Toolbox.Library.Forms
}
//The process takes awhile atm so limit splitting if there's a high amount
private readonly int MAX_FILE_PATH_SPLIT = 5000;
private readonly int MAX_FILE_LOAD = 5000;
void FillTreeNodes(TreeNode root, IArchiveFile archiveFile)
{
var rootText = root.Text;
var rootTextLength = rootText.Length;
var nodeFiles = archiveFile.Files;
if (nodeFiles.Count() > MAX_FILE_PATH_SPLIT)
{
foreach (var node in nodeFiles)
{
ArchiveFileWrapper wrapperFile = new ArchiveFileWrapper(node.FileName, node, archiveFile);
root.Nodes.Add(wrapperFile);
}
}
else
{
int I = 0;
foreach (var node in nodeFiles)
{
if (I++ > MAX_FILE_LOAD)
break;
string nodeString = node.FileName;
var roots = nodeString.Split(new char[] { '/' },
@ -97,7 +92,6 @@ namespace Switch_Toolbox.Library.Forms
}
}
}
}
public void AddNodeCollection(TreeNodeCollection nodes, bool ClearNodes)
{