Only load certain supported formats for sdf for faster loading. (Can still be extracted as all normally)

This commit is contained in:
KillzXGaming 2019-06-22 07:57:26 -04:00
parent 285eb3a028
commit 54e88cdef5
9 changed files with 21 additions and 2 deletions

Binary file not shown.

View file

@ -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

View file

@ -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;

View file

@ -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()
{