Account fot tex2 files for RSTB size fixing

This commit is contained in:
KillzXGaming 2019-06-15 10:44:22 -04:00
parent c50f3dc86e
commit 1b2de8c7cf
6 changed files with 12 additions and 0 deletions

Binary file not shown.

View file

@ -132,6 +132,9 @@ namespace Switch_Toolbox.Library.IO
else else
STConsole.WriteLine("Failed to find path in File Size List table! " + newFilePath, 0); STConsole.WriteLine("Failed to find path in File Size List table! " + newFilePath, 0);
if (FileFormat == null)
return FileLog;
//Check if archive type //Check if archive type
bool IsArchive = false; bool IsArchive = false;
foreach (var inter in FileFormat.GetType().GetInterfaces()) foreach (var inter in FileFormat.GetType().GetInterfaces())
@ -174,10 +177,19 @@ namespace Switch_Toolbox.Library.IO
public static void SaveFileFormat(byte[] data, bool FileIsCompressed, int Alignment, public static void SaveFileFormat(byte[] data, bool FileIsCompressed, int Alignment,
CompressionType CompressionType, string FileName, bool EnableDialog = true, string DetailsLog = "") CompressionType CompressionType, string FileName, bool EnableDialog = true, string DetailsLog = "")
{ {
uint DecompressedSize = (uint)data.Length;
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
byte[] FinalData = CompressFileFormat(data, FileIsCompressed, Alignment, CompressionType, FileName, EnableDialog); byte[] FinalData = CompressFileFormat(data, FileIsCompressed, Alignment, CompressionType, FileName, EnableDialog);
File.WriteAllBytes(FileName, FinalData); File.WriteAllBytes(FileName, FinalData);
uint CompressedSize = (uint)FinalData.Length;
DetailsLog += "\n" + SatisfyFileTables(null, FileName, data,
DecompressedSize,
CompressedSize,
FileIsCompressed);
MessageBox.Show($"File has been saved to {FileName}", "Save Notification"); MessageBox.Show($"File has been saved to {FileName}", "Save Notification");
// STSaveLogDialog.Show($"File has been saved to {FileName}", "Save Notification", DetailsLog); // STSaveLogDialog.Show($"File has been saved to {FileName}", "Save Notification", DetailsLog);