[DatFile] Respect the archivesAsFiles and enableGzip flags

This commit is contained in:
Matt Nadareski
2017-03-29 11:32:22 -07:00
parent 65b2b187d6
commit c53635b623

View File

@@ -202,8 +202,17 @@ namespace SabreTools.Helper.Dats
} }
// Create a list for all found items // Create a list for all found items
List<Rom> extracted = new List<Rom>(); List<Rom> extracted = null;
// Temporarily set the archivesAsFiles if we have a GZip archive and we're not supposed to use it as one
if (archivesAsFiles && !enableGzip && newItem.EndsWith(".gz"))
{
archivesAsFiles = false;
}
// If we don't have archives as files, try to scan the file as an archive
if (!archivesAsFiles)
{
// If all deep hash skip flags are set, do a quickscan // If all deep hash skip flags are set, do a quickscan
if (omitFromScan == Hash.SecureHashes) if (omitFromScan == Hash.SecureHashes)
{ {
@@ -214,9 +223,10 @@ namespace SabreTools.Helper.Dats
{ {
extracted = ArchiveTools.GetExtendedArchiveFileInfo(newItem, omitFromScan: omitFromScan, date: addDate); extracted = ArchiveTools.GetExtendedArchiveFileInfo(newItem, omitFromScan: omitFromScan, date: addDate);
} }
}
// If the extracted list is null, just scan the item itself // If the extracted list is null, just scan the item itself
if (extracted == null) if (extracted == null || archivesAsFiles)
{ {
PopulateFromDirProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst); PopulateFromDirProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst);
} }