mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
Only load certain supported formats for sdf for faster loading. (Can still be extracted as all normally)
This commit is contained in:
parent
285eb3a028
commit
54e88cdef5
9 changed files with 21 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -105,10 +105,16 @@ namespace FirstPlugin
|
|||
endId = new SDFTOC_ID(reader);
|
||||
|
||||
for (int i = 0; i < FileEntries.Count; i++)
|
||||
files.Add(FileEntries[i]);
|
||||
{
|
||||
FileEntries[i].CanLoadFile = SupportedExtensions.Contains(Utils.GetExtension(FileEntries[i].FileName));
|
||||
files.Add(FileEntries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> SupportedExtensions = new List<string>()
|
||||
{ ".dds", ".tga" ,".mmb", ".png", ".jpg" };
|
||||
|
||||
private TreeNode GetNodes(TreeNode parent, string[] fileList)
|
||||
{
|
||||
// build a TreeNode collection from the file list
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -42,8 +42,17 @@ namespace Switch_Toolbox.Library.Forms
|
|||
int I = 0;
|
||||
foreach (var node in nodeFiles)
|
||||
{
|
||||
if (!node.CanLoadFile)
|
||||
continue;
|
||||
|
||||
if (I++ == MAX_TREENODE_VALUE)
|
||||
break;
|
||||
{
|
||||
var result = MessageBox.Show($"The amount of treenodes has reached over {MAX_TREENODE_VALUE} nodes. To prevent memory loss this is put in place. Do you want to continue loading all of them?",
|
||||
"", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
|
||||
|
||||
if (result != DialogResult.Yes)
|
||||
break;
|
||||
}
|
||||
|
||||
string nodeString = node.FileName;
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ namespace Switch_Toolbox.Library
|
|||
[Browsable(false)]
|
||||
public virtual object DisplayProperties { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual bool CanLoadFile { get; set; } = true;
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual IFileFormat OpenFile()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue