[SimpleSort] Set framework for quick matching

This commit is contained in:
Matt Nadareski
2016-06-15 15:15:51 -07:00
parent 07f1f97fc8
commit e9cb58464f

View File

@@ -400,6 +400,42 @@ namespace SabreTools
}
}
/// TODO: Implement flag for external scanning only
bool externalScan = false;
if (externalScan)
{
List<RomData> internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger);
// If the list is populated, then the file was a filled archive
if (internalRomData.Count >= 0)
{
foreach (RomData rom in internalRomData)
{
// Try to find the matches to the file that was found
List<RomData> foundroms = RomTools.GetDuplicates(rom, _datdata);
_logger.User("File '" + rom.Name + "' had " + foundroms.Count + " matches in the DAT!");
foreach (RomData found in foundroms)
{
_logger.Log("Matched name: " + found.Name);
string newinput = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger);
if (newinput != null && File.Exists(newinput))
{
ArchiveTools.WriteToArchive(newinput, _outdir, found);
try
{
File.Delete(newinput);
}
catch (Exception ex)
{
_logger.Error(ex.ToString());
}
}
}
}
}
}
else
{
// Now, if the file is a supported archive type, also run on all files within
bool encounteredErrors = !ArchiveTools.ExtractArchive(input, _tempdir, _7z, _gz, _rar, _zip, _logger);
@@ -425,6 +461,7 @@ namespace SabreTools
success &= ProcessFile(file, true);
}
}
}
return success;
}