diff --git a/RecursiveExtractor/Extractors/AceExtractor.cs b/RecursiveExtractor/Extractors/AceExtractor.cs
index ae0429f..54c0b2f 100644
--- a/RecursiveExtractor/Extractors/AceExtractor.cs
+++ b/RecursiveExtractor/Extractors/AceExtractor.cs
@@ -29,11 +29,11 @@ public AceExtractor(Extractor context)
///
public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- AceReader? aceReader = null;
+ IReader? aceReader = null;
try
{
fileEntry.Content.Position = 0;
- aceReader = AceReader.Open(fileEntry.Content, new ReaderOptions()
+ aceReader = AceReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -100,11 +100,11 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
///
public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- AceReader? aceReader = null;
+ IReader? aceReader = null;
try
{
fileEntry.Content.Position = 0;
- aceReader = AceReader.Open(fileEntry.Content, new ReaderOptions()
+ aceReader = AceReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
diff --git a/RecursiveExtractor/Extractors/ArcExtractor.cs b/RecursiveExtractor/Extractors/ArcExtractor.cs
index 5b33bd1..8247b15 100644
--- a/RecursiveExtractor/Extractors/ArcExtractor.cs
+++ b/RecursiveExtractor/Extractors/ArcExtractor.cs
@@ -29,11 +29,11 @@ public ArcExtractor(Extractor context)
///
public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- ArcReader? arcReader = null;
+ IReader? arcReader = null;
try
{
fileEntry.Content.Position = 0;
- arcReader = ArcReader.Open(fileEntry.Content, new ReaderOptions()
+ arcReader = ArcReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -103,11 +103,11 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
///
public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- ArcReader? arcReader = null;
+ IReader? arcReader = null;
try
{
fileEntry.Content.Position = 0;
- arcReader = ArcReader.Open(fileEntry.Content, new ReaderOptions()
+ arcReader = ArcReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
diff --git a/RecursiveExtractor/Extractors/ArjExtractor.cs b/RecursiveExtractor/Extractors/ArjExtractor.cs
index 4c1f324..bb83687 100644
--- a/RecursiveExtractor/Extractors/ArjExtractor.cs
+++ b/RecursiveExtractor/Extractors/ArjExtractor.cs
@@ -29,11 +29,11 @@ public ArjExtractor(Extractor context)
///
public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- ArjReader? arjReader = null;
+ IReader? arjReader = null;
try
{
fileEntry.Content.Position = 0;
- arjReader = ArjReader.Open(fileEntry.Content, new ReaderOptions()
+ arjReader = ArjReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -100,11 +100,11 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
///
public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- ArjReader? arjReader = null;
+ IReader? arjReader = null;
try
{
fileEntry.Content.Position = 0;
- arjReader = ArjReader.Open(fileEntry.Content, new ReaderOptions()
+ arjReader = ArjReader.OpenReader(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
diff --git a/RecursiveExtractor/Extractors/BZip2Extractor.cs b/RecursiveExtractor/Extractors/BZip2Extractor.cs
index 60ff524..0276b40 100644
--- a/RecursiveExtractor/Extractors/BZip2Extractor.cs
+++ b/RecursiveExtractor/Extractors/BZip2Extractor.cs
@@ -40,7 +40,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
var failed = false;
try
{
- using var bzipStream = new BZip2Stream(fileEntry.Content, CompressionMode.Decompress, false);
+ using var bzipStream = BZip2Stream.Create(fileEntry.Content, CompressionMode.Decompress, false, leaveOpen: false);
await bzipStream.CopyToAsync(fs);
}
catch (Exception e)
@@ -99,7 +99,7 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
try
{
- using var bzipStream = new BZip2Stream(fileEntry.Content, CompressionMode.Decompress, false);
+ using var bzipStream = BZip2Stream.Create(fileEntry.Content, CompressionMode.Decompress, false, leaveOpen: false);
bzipStream.CopyTo(fs);
}
catch (Exception e)
@@ -139,4 +139,4 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
}
}
}
-}
\ No newline at end of file
+}
diff --git a/RecursiveExtractor/Extractors/RarExtractor.cs b/RecursiveExtractor/Extractors/RarExtractor.cs
index 829b3d3..85d7ff8 100644
--- a/RecursiveExtractor/Extractors/RarExtractor.cs
+++ b/RecursiveExtractor/Extractors/RarExtractor.cs
@@ -31,7 +31,7 @@ public RarExtractor(Extractor context)
try
{
- rarArchive = RarArchive.Open(fileEntry.Content);
+ rarArchive = (RarArchive)RarArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { LeaveStreamOpen = true });
// Test for invalid archives. This will throw invalidformatexception
var t = rarArchive.IsSolid;
if (rarArchive.Entries.Any(x => x.IsEncrypted))
@@ -66,7 +66,7 @@ public RarExtractor(Extractor context)
try
{
fileEntry.Content.Position = 0;
- rarArchive = RarArchive.Open(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { Password = password, LookForHeader = true });
+ rarArchive = (RarArchive)RarArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { Password = password, LookForHeader = true, LeaveStreamOpen = true });
var byt = new byte[1];
var encryptedEntry = rarArchive.Entries.FirstOrDefault(x => x is { IsEncrypted: true, Size: > 0 });
// Justification for !: Because we use FirstOrDefault encryptedEntry may be null, but we have a catch below for it
@@ -197,4 +197,4 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
}
}
}
-}
\ No newline at end of file
+}
diff --git a/RecursiveExtractor/Extractors/SevenZipExtractor.cs b/RecursiveExtractor/Extractors/SevenZipExtractor.cs
index 40f6b68..869da19 100644
--- a/RecursiveExtractor/Extractors/SevenZipExtractor.cs
+++ b/RecursiveExtractor/Extractors/SevenZipExtractor.cs
@@ -83,7 +83,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
var needsPassword = false;
try
{
- sevenZipArchive = SevenZipArchive.Open(fileEntry.Content);
+ sevenZipArchive = (SevenZipArchive)SevenZipArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { LeaveStreamOpen = true });
if (sevenZipArchive.Entries.Where(x => !x.IsDirectory).Any(x => x.IsEncrypted))
{
needsPassword = true;
@@ -114,7 +114,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
try
{
fileEntry.Content.Position = 0;
- sevenZipArchive = SevenZipArchive.Open(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { Password = password });
+ sevenZipArchive = (SevenZipArchive)SevenZipArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions() { Password = password, LeaveStreamOpen = true });
// When filenames are encrypted we can't access the size of individual files
// But if we can accesss the total uncompressed size we have the right password
try
@@ -197,4 +197,4 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
}
}
}
-}
\ No newline at end of file
+}
diff --git a/RecursiveExtractor/Extractors/TarExtractor.cs b/RecursiveExtractor/Extractors/TarExtractor.cs
index 0d7329d..662f859 100644
--- a/RecursiveExtractor/Extractors/TarExtractor.cs
+++ b/RecursiveExtractor/Extractors/TarExtractor.cs
@@ -29,7 +29,7 @@ public TarExtractor(Extractor context)
///
public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- using TarArchive archive = TarArchive.Open(fileEntry.Content, new SharpCompress.Readers.ReaderOptions()
+ using TarArchive archive = (TarArchive)TarArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -103,7 +103,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
///
public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor, bool topLevel = true)
{
- using TarArchive archive = TarArchive.Open(fileEntry.Content, new SharpCompress.Readers.ReaderOptions()
+ using TarArchive archive = (TarArchive)TarArchive.OpenArchive(fileEntry.Content, new SharpCompress.Readers.ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -224,4 +224,4 @@ internal TarEntryCollectionEnumerator(ICollection entries, stri
}
}
}
-}
\ No newline at end of file
+}
diff --git a/RecursiveExtractor/Extractors/ZipExtractor.cs b/RecursiveExtractor/Extractors/ZipExtractor.cs
index 49da757..5140a60 100644
--- a/RecursiveExtractor/Extractors/ZipExtractor.cs
+++ b/RecursiveExtractor/Extractors/ZipExtractor.cs
@@ -37,7 +37,7 @@ public ZipExtractor(Extractor context)
{
// Create a new archive instance with the password to test it
fileEntry.Content.Position = 0;
- using var testArchive = ZipArchive.Open(fileEntry.Content, new ReaderOptions()
+ using var testArchive = (ZipArchive)ZipArchive.OpenArchive(fileEntry.Content, new ReaderOptions()
{
Password = password,
LeaveStreamOpen = true
@@ -73,7 +73,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
try
{
fileEntry.Content.Position = 0;
- zipArchive = ZipArchive.Open(fileEntry.Content, new ReaderOptions()
+ zipArchive = (ZipArchive)ZipArchive.OpenArchive(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -104,7 +104,7 @@ public async IAsyncEnumerable ExtractAsync(FileEntry fileEntry, Extra
// Recreate archive with password
zipArchive.Dispose();
fileEntry.Content.Position = 0;
- zipArchive = ZipArchive.Open(fileEntry.Content, new ReaderOptions()
+ zipArchive = (ZipArchive)ZipArchive.OpenArchive(fileEntry.Content, new ReaderOptions()
{
Password = foundPassword,
LeaveStreamOpen = true
@@ -199,7 +199,7 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
try
{
fileEntry.Content.Position = 0;
- zipArchive = ZipArchive.Open(fileEntry.Content, new ReaderOptions()
+ zipArchive = (ZipArchive)ZipArchive.OpenArchive(fileEntry.Content, new ReaderOptions()
{
LeaveStreamOpen = true
});
@@ -230,7 +230,7 @@ public IEnumerable Extract(FileEntry fileEntry, ExtractorOptions opti
// Recreate archive with password
zipArchive.Dispose();
fileEntry.Content.Position = 0;
- zipArchive = ZipArchive.Open(fileEntry.Content, new ReaderOptions()
+ zipArchive = (ZipArchive)ZipArchive.OpenArchive(fileEntry.Content, new ReaderOptions()
{
Password = foundPassword,
LeaveStreamOpen = true
@@ -329,7 +329,7 @@ private async IAsyncEnumerable YieldNonIndexedEntriesAsync(
IReader? forwardReader = null;
try
{
- forwardReader = ReaderFactory.Open(parentEntry.Content, new ReaderOptions { LeaveStreamOpen = true });
+ forwardReader = ReaderFactory.OpenReader(parentEntry.Content, new ReaderOptions { LeaveStreamOpen = true });
}
catch (Exception ex)
{
@@ -413,7 +413,7 @@ private IEnumerable YieldNonIndexedEntries(
IReader? forwardReader = null;
try
{
- forwardReader = ReaderFactory.Open(parentEntry.Content, new ReaderOptions { LeaveStreamOpen = true });
+ forwardReader = ReaderFactory.OpenReader(parentEntry.Content, new ReaderOptions { LeaveStreamOpen = true });
}
catch (Exception ex)
{
diff --git a/RecursiveExtractor/RecursiveExtractor.csproj b/RecursiveExtractor/RecursiveExtractor.csproj
index 1b6bd27..5c0bb1d 100644
--- a/RecursiveExtractor/RecursiveExtractor.csproj
+++ b/RecursiveExtractor/RecursiveExtractor.csproj
@@ -48,7 +48,7 @@
-
+