mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools] Reorganize code to make more sense
This commit is contained in:
@@ -187,6 +187,23 @@ namespace SabreTools.Helper
|
||||
sza.WriteToDirectory(tempdir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
encounteredErrors = false;
|
||||
}
|
||||
else if (at == ArchiveType.GZip && gz != ArchiveScanLevel.External)
|
||||
{
|
||||
// Create the temp directory
|
||||
Directory.CreateDirectory(tempdir);
|
||||
|
||||
using (FileStream itemstream = File.OpenRead(input))
|
||||
{
|
||||
using (FileStream outstream = File.Create(tempdir + Path.GetFileNameWithoutExtension(input)))
|
||||
{
|
||||
using (GZipStream gzstream = new GZipStream(itemstream, CompressionMode.Decompress))
|
||||
{
|
||||
gzstream.CopyTo(outstream);
|
||||
}
|
||||
}
|
||||
}
|
||||
encounteredErrors = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader = ReaderFactory.Open(File.OpenRead(input));
|
||||
@@ -202,26 +219,6 @@ namespace SabreTools.Helper
|
||||
reader.WriteAllToDirectory(tempdir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
encounteredErrors = false;
|
||||
}
|
||||
else if (at == ArchiveType.GZip && gz != ArchiveScanLevel.External)
|
||||
{
|
||||
// Close the original archive handle
|
||||
reader.Dispose();
|
||||
|
||||
// Create the temp directory
|
||||
Directory.CreateDirectory(tempdir);
|
||||
|
||||
using (FileStream itemstream = File.OpenRead(input))
|
||||
{
|
||||
using (FileStream outstream = File.Create(tempdir + Path.GetFileNameWithoutExtension(input)))
|
||||
{
|
||||
using (GZipStream gzstream = new GZipStream(itemstream, CompressionMode.Decompress))
|
||||
{
|
||||
gzstream.CopyTo(outstream);
|
||||
}
|
||||
}
|
||||
}
|
||||
encounteredErrors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
|
||||
Reference in New Issue
Block a user