Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading a rar stream from a rar file gets NotSupportedException Specified method is not supported #861

Open
Sonic3R opened this issue Aug 6, 2024 · 1 comment

Comments

@Sonic3R
Copy link

Sonic3R commented Aug 6, 2024

Hi,

I'm using latest library version 0.37.2, at this moment of creating issue.

I have multi volume archive protected by password. That archive contains a subset of other archives, rar files especially.

There is my code:

var folder = @"D:\myfolder";
var rars = Directory.GetFiles(folder, "*.rar");
var pass = "abcdef1230213";

using var archive = RarArchive.Open(rars.Select(File.OpenRead), new SharpCompress.Readers.ReaderOptions { Password = pass });
foreach (var entry in archive.Entries.Where(c => !c.IsDirectory))
{
  Console.WriteLine(entry.Key);

  if (entry.Key!.EndsWith(".rar"))
  {
        using var stream = entry.OpenEntryStream();
        var r = RarArchive.IsRarFile(stream);
        using var subArchive = RarArchive.Open(stream);
        if (subArchive.Entries.Count > 0)   // here is the exception occurrence
        {
            foreach (var subEntry in subArchive.Entries.Where(c => !c.IsDirectory))
            {
                Console.WriteLine(subEntry.Key);
            }
        }
    }
}

What I'm doing wrong ?

@adamhathcock
Copy link
Owner

Maybe the inner rar needs a password? I can't tell from the usage, A full stacktrace would help with the password issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants