mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools, SimpleSort] Fix archive to archive writing, use it
This commit is contained in:
@@ -283,11 +283,11 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
if (outarchive.Mode == ZipArchiveMode.Create || outarchive.GetEntry(outentryname) == null)
|
if (outarchive.Mode == ZipArchiveMode.Create || outarchive.GetEntry(outentryname) == null)
|
||||||
{
|
{
|
||||||
IArchiveEntry iae = outarchive.CreateEntry(outentryname, CompressionLevel.Optimal) as IArchiveEntry;
|
ZipArchiveEntry iae = outarchive.CreateEntry(outentryname, CompressionLevel.Optimal) as ZipArchiveEntry;
|
||||||
using (Stream iaestream = iae.OpenEntryStream())
|
|
||||||
using (Stream readerstream = (reader.Entry as IArchiveEntry).OpenEntryStream())
|
using (Stream iaestream = iae.Open())
|
||||||
{
|
{
|
||||||
readerstream.CopyTo(iaestream);
|
reader.WriteEntryTo(iaestream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
|
|||||||
@@ -444,6 +444,14 @@ namespace SabreTools
|
|||||||
foreach (Rom found in foundroms)
|
foreach (Rom found in foundroms)
|
||||||
{
|
{
|
||||||
_logger.Log("Matched name: " + found.Name);
|
_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);
|
string newinput = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger);
|
||||||
if (newinput != null && File.Exists(newinput))
|
if (newinput != null && File.Exists(newinput))
|
||||||
{
|
{
|
||||||
@@ -458,6 +466,7 @@ namespace SabreTools
|
|||||||
// Don't log file deletion errors
|
// Don't log file deletion errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user