Quantcast
Channel: sharpcompress Discussions Rss Feed
Viewing all articles
Browse latest Browse all 239

New Post: Reading solid rar archive streams

$
0
0

Hello,

Is it possible to read solid RAR archives in the following way:

 

privatebool LoadArchive(string streamname)

{

IArchive archive = null; IReader reader = null; List streams = null; try { archive = RarArchive.Open(streamname, Options.KeepStreamsOpen); streams = archive.Volumes.Select(volume => volume.VolumeFile.OpenRead()).Cast().ToList(); reader = RarReader.Open(streams, Options.KeepStreamsOpen); while (reader.MoveToNextEntry()) { if (reader.Entry.IsDirectory) continue; try { using (EntryStream arcstream = reader.OpenEntryStream()) { string filename = reader.Entry.FilePath; bool result = Load(type, filename, arcstream); if (!result) arcstream.SkipEntry(); } } catch (ExtractionException ex) { } } } finally { if (reader != null) reader.Dispose(); if (archive != null) archive.Dispose(); if (streams != null) foreach (Stream s in streams) s.Dispose();        }
}

 

I get correct stream for the first entry, but wrong data for the second and so on.

 


Viewing all articles
Browse latest Browse all 239

Trending Articles