[DatFile] Exception for TGZ->TGZ rebuild

This commit is contained in:
Matt Nadareski
2017-03-16 15:15:46 -07:00
parent f535914428
commit d083ef4ed8

View File

@@ -458,9 +458,6 @@ namespace SabreTools.Helper.Dats
/// <param name="isZip">True if the input file is an archive, false otherwise</param>
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
/// <returns>True if the file was able to be rebuilt, false otherwise</returns>
/// <remarks>
/// TODO: If going from a TGZ file to a TGZ file, don't extract, just copy
/// </remarks>
private bool RebuildIndividualFile(Rom rom, string file, string outDir, string tempDir, bool date,
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, bool isZip, string headerToCheckAgainst)
{
@@ -482,6 +479,32 @@ namespace SabreTools.Helper.Dats
return rebuilt;
}
// If we have a very specifc TGZ->TGZ case, just copy it accordingly
if (isZip && ArchiveTools.GetTorrentGZFileInfo(file) != null && outputFormat == OutputFormat.TorrentGzip)
{
// Get the proper output path
if (romba)
{
outDir = Path.Combine(outDir, Style.GetRombaPath(rom.SHA1));
}
// Make sure the output folder is created
Directory.CreateDirectory(Path.GetDirectoryName(outDir));
// Now copy the file over
try
{
File.Copy(file, outDir);
rebuilt &= true;
}
catch
{
rebuilt = false;
}
return rebuilt;
}
// If we have an archive input, get the real name of the file to use
// TODO: Remove the need to extract the file first; reimplement ArchiveToArchive?
if (isZip)
@@ -555,6 +578,32 @@ namespace SabreTools.Helper.Dats
{
string machinename = null;
// If we have a very specifc TGZ->TGZ case, just copy it accordingly
if (isZip && ArchiveTools.GetTorrentGZFileInfo(file) != null && outputFormat == OutputFormat.TorrentGzip)
{
// Get the proper output path
if (romba)
{
outDir = Path.Combine(outDir, Style.GetRombaPath(rom.SHA1));
}
// Make sure the output folder is created
Directory.CreateDirectory(Path.GetDirectoryName(outDir));
// Now copy the file over
try
{
File.Copy(file, outDir);
rebuilt &= true;
}
catch
{
rebuilt = false;
}
return rebuilt;
}
// If we have an archive input, get the real name of the file to use
if (isZip)
{