Slightly better entry generation

This commit is contained in:
Matt Nadareski
2020-10-04 14:14:57 -07:00
parent bfab4a61e9
commit 4f162fc91d
4 changed files with 53 additions and 68 deletions

View File

@@ -296,34 +296,26 @@ namespace SabreTools.Library.FileTypes
continue;
}
// Create a blank item for the entry
BaseFile zipEntryRom = new BaseFile();
// Perform a quickscan, if flagged to
if (QuickScan)
{
string newname = zf.Filename(i);
long newsize = (long)zf.UncompressedSize(i);
byte[] newcrc = zf.CRC32(i);
string convertedDate = zf.LastModified(i).ToString("yyyy/MM/dd hh:mm:ss");
found.Add(new BaseFile
{
Filename = newname,
Size = newsize,
CRC = newcrc,
Date = convertedDate,
Parent = gamename,
});
zipEntryRom.Size = (long)zf.UncompressedSize(i);
zipEntryRom.CRC = zf.CRC32(i);
}
// Otherwise, use the stream directly
else
{
BaseFile zipEntryRom = readStream.GetInfo(size: (long)zf.UncompressedSize(i), keepReadOpen: true);
zipEntryRom.Filename = zf.Filename(i);
zipEntryRom.Parent = gamename;
string convertedDate = zf.LastModified(i).ToString("yyyy/MM/dd hh:mm:ss");
zipEntryRom.Date = convertedDate;
found.Add(zipEntryRom);
zipEntryRom = readStream.GetInfo(size: (long)zf.UncompressedSize(i), keepReadOpen: true);
}
// Fill in comon details and add to the list
zipEntryRom.Filename = zf.Filename(i);
zipEntryRom.Parent = gamename;
zipEntryRom.Date = zf.LastModified(i).ToString("yyyy/MM/dd hh:mm:ss");
found.Add(zipEntryRom);
}
// Dispose of the archive