Reader options apparently moved fully

This commit is contained in:
Matt Nadareski
2026-03-17 19:47:27 -04:00
parent 9389797448
commit 75fef90a14
3 changed files with 21 additions and 23 deletions

View File

@@ -27,9 +27,7 @@ namespace SabreTools.Serialization.Wrappers
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
var zipFile = ZipArchive.OpenArchive(_dataSource, readerOptions) as ZipArchive;
if (zipFile is null)
return false;
var zipFile = (ZipArchive)ZipArchive.OpenArchive(_dataSource, readerOptions);
// If the file exists
if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!))
@@ -39,11 +37,11 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
zipFile = ZipArchive.OpenArchive(parts, readerOptions) as ZipArchive;
zipFile = (ZipArchive)ZipArchive.OpenArchive(parts, readerOptions);
// Try to read the file path if no entries are found
else if (zipFile.Entries.Count == 0)
zipFile = ZipArchive.OpenArchive(parts, readerOptions) as ZipArchive;
zipFile = (ZipArchive)ZipArchive.OpenArchive(parts, readerOptions);
// If the archive is somehow null
if (zipFile is null)

View File

@@ -31,10 +31,13 @@ namespace SabreTools.Serialization.Wrappers
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
var rarFile = RarArchive.OpenArchive(_dataSource, readerOptions) as RarArchive;
if (rarFile is null)
return false;
var readerOptions = new ReaderOptions()
{
LookForHeader = lookForHeader,
ExtractFullPath = true,
Overwrite = true
};
var rarFile = (RarArchive)RarArchive.OpenArchive(_dataSource, readerOptions);
// If the file exists
if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!))
@@ -44,15 +47,11 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
rarFile = RarArchive.OpenArchive(parts, readerOptions) as RarArchive;
rarFile = (RarArchive)RarArchive.OpenArchive(parts, readerOptions);
// Try to read the file path if no entries are found
else if (rarFile.Entries.Count == 0)
rarFile = RarArchive.OpenArchive(parts, readerOptions) as RarArchive;
// If the archive is somehow null
if (rarFile is null)
return false;
rarFile = (RarArchive)RarArchive.OpenArchive(parts, readerOptions);
}
// Explained in https://github.com/adamhathcock/sharpcompress/pull/661. in order to determine whether

View File

@@ -31,8 +31,13 @@ namespace SabreTools.Serialization.Wrappers
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
var sevenZip = SevenZipArchive.OpenArchive(_dataSource, readerOptions) as SevenZipArchive;
var readerOptions = new ReaderOptions()
{
LookForHeader = lookForHeader,
ExtractFullPath = true,
Overwrite = true
};
var sevenZip = (SevenZipArchive)SevenZipArchive.OpenArchive(_dataSource, readerOptions);
if (sevenZip is null)
return false;
@@ -44,15 +49,11 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
sevenZip = SevenZipArchive.OpenArchive(parts, readerOptions) as SevenZipArchive;
sevenZip = (SevenZipArchive)SevenZipArchive.OpenArchive(parts, readerOptions);
// Try to read the file path if no entries are found
else if (sevenZip.Entries.Count == 0)
sevenZip = SevenZipArchive.OpenArchive(parts, readerOptions) as SevenZipArchive;
// If the archive is somehow null
if (sevenZip is null)
return false;
sevenZip = (SevenZipArchive)SevenZipArchive.OpenArchive(parts, readerOptions);
}
// Explained in https://github.com/adamhathcock/sharpcompress/pull/661. in order to determine whether