[ArchiveTools, SimpleSort] Fix archive to archive writing, use it

This commit is contained in:
Matt Nadareski
2016-06-21 00:47:39 -07:00
parent 79ee37100b
commit 7ea9a239b3
2 changed files with 13 additions and 4 deletions

View File

@@ -283,11 +283,11 @@ namespace SabreTools.Helper
if (outarchive.Mode == ZipArchiveMode.Create || outarchive.GetEntry(outentryname) == null)
{
IArchiveEntry iae = outarchive.CreateEntry(outentryname, CompressionLevel.Optimal) as IArchiveEntry;
using (Stream iaestream = iae.OpenEntryStream())
using (Stream readerstream = (reader.Entry as IArchiveEntry).OpenEntryStream())
ZipArchiveEntry iae = outarchive.CreateEntry(outentryname, CompressionLevel.Optimal) as ZipArchiveEntry;
using (Stream iaestream = iae.Open())
{
readerstream.CopyTo(iaestream);
reader.WriteEntryTo(iaestream);
}
}
success = true;

View File

@@ -444,6 +444,14 @@ namespace SabreTools
foreach (Rom found in foundroms)
{
_logger.Log("Matched name: " + found.Name);
// Copy file between archives
_logger.User("Rebuilding file '" + Path.GetFileName(rom.Name) + "' to '" + found.Name + "'");
string archiveFileName = Path.Combine(_outdir, found.Game + ".zip");
ArchiveTools.CopyFileBetweenArchives(input, archiveFileName, rom.Name, found.Name, _logger);
/*
// Extract file into temp and then rebuild
string newinput = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger);
if (newinput != null && File.Exists(newinput))
{
@@ -458,6 +466,7 @@ namespace SabreTools
// Don't log file deletion errors
}
}
*/
}
}
}