1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Quick SDF fix

This commit is contained in:
KillzXGaming 2019-06-18 15:48:18 -04:00
parent b0cecddee4
commit b1b9230146
2 changed files with 8 additions and 4 deletions

View File

@ -104,8 +104,6 @@ namespace FirstPlugin
//Read last id
endId = new SDFTOC_ID(reader);
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++)
files.Add(FileEntries[i]);
}
@ -199,6 +197,10 @@ namespace FirstPlugin
set { base.FileData = value;}
}
public override string FileSize => STMath.GetFileSize((long)DecompressedSize, 4);
public override object DisplayProperties => this;
public override IFileFormat OpenFile()
{
var FileFormat = STFileLoader.OpenFileFormat(
@ -226,8 +228,7 @@ namespace FirstPlugin
if (!Directory.Exists(FolerPath))
Directory.CreateDirectory(FolerPath);
block.Dispose();
return stream.getSection((int)Offset, (int)DecompressedSize);
Data.Add(stream.getSection((int)Offset, (int)DecompressedSize));
}
else
{

View File

@ -39,6 +39,9 @@ namespace Switch_Toolbox.Library
{
using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true))
{
if (reader.BaseStream.Length < 30)
return false;
reader.Position = reader.BaseStream.Length - 18;
bool IsValidMagic = reader.ReadString(10) == MagicFileConstant;
return IsValidMagic || Utils.GetExtension(FileName) == ".tga";