Only get the filedata once for opening archive editors for quicker loading/less memory usage
This commit is contained in:
parent
55fa5381fa
commit
c879ec7839
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -247,15 +247,13 @@ namespace FirstPlugin
|
||||
|
||||
if (UseDDS)
|
||||
{
|
||||
// Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)SDFParent.block2Array[DdsType].UsedBytes).ToArray());
|
||||
|
||||
bool IsDX10 = false;
|
||||
using (var filereader = new FileReader(SDFParent.block2Array[DdsType].Data))
|
||||
{
|
||||
filereader.Position = 84;
|
||||
IsDX10 = filereader.ReadString(4) == "DX10";
|
||||
|
||||
if (IsDX10)
|
||||
if (IsDX10)
|
||||
{
|
||||
if (SDFParent.block2Array[DdsType].UsedBytes > 0x94)
|
||||
IsSwizzled = true;
|
||||
@ -440,8 +438,6 @@ namespace FirstPlugin
|
||||
|
||||
bool IsFile = !Name.Contains("dummy") && decompresedSize > 5;
|
||||
|
||||
Console.WriteLine(Name + " " + IsFile);
|
||||
|
||||
if (IsFile)
|
||||
{
|
||||
FileEntries.Add(new FileEntry()
|
||||
|
Binary file not shown.
Binary file not shown.
@ -61,26 +61,27 @@ namespace Switch_Toolbox.Library.Forms
|
||||
{
|
||||
if (GetEditor() == 0)
|
||||
UpdatePropertiesView();
|
||||
if (GetEditor() == 1)
|
||||
else if (GetEditor() == 1)
|
||||
UpdateHexView();
|
||||
if (GetEditor() == 2)
|
||||
else if (GetEditor() == 2)
|
||||
UpdateFileEditor();
|
||||
if (GetEditor() == 3)
|
||||
else if (GetEditor() == 3)
|
||||
UpdateTextView();
|
||||
}
|
||||
|
||||
private void UpdateFileEditor()
|
||||
{
|
||||
if (!ArchiveFileInfo.IsSupportedFileFormat())
|
||||
var File = ArchiveFileInfo.FileFormat;
|
||||
if (File == null) //If the file is not open yet, try temporarily for a preview
|
||||
File = ArchiveFileInfo.OpenFile();
|
||||
|
||||
//If the file is still null, just add a basic control and return
|
||||
if (File == null)
|
||||
{
|
||||
AddControl(new STUserControl());
|
||||
return;
|
||||
}
|
||||
|
||||
var File = ArchiveFileInfo.FileFormat;
|
||||
if (File == null) //If the file is not open yet, try temporarily for a preview
|
||||
File = ArchiveFileInfo.OpenFile();
|
||||
|
||||
SetEditorForm(File);
|
||||
|
||||
//If the format isn't active we can just dispose it
|
||||
|
Loading…
Reference in New Issue
Block a user