mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-08 13:34:57 +00:00
Multi-volume Rar streams #170
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @krvi on GitHub (Apr 20, 2017).
I'm attempting to read the contents of multi-volume Rar archive. The archive is never written to disk so I need to read them as streams. I do the following steps.
1: Declare a dictionary, rather than List, simply for ease of ordering/sorting.
var rd = new Dictionary<string, Stream>();2: Populate the dictionary.
2.5: Ensure that the streams are ordered. For example:
file.part1.rar
file.part2.rar
file.part2.rar
or
file.rar
file.r00
file.r01
3: Open archive
var ra = RarArchive.Open(rd.Values.AsEnumerable());From what I've read it is supposed to work with this procedure. However, it does not work.
ra.WriteToDirectory(@"C:\test\");Produces nothing and neither doesIf I open the archive with only the first volume with ArchiveFactory
var ra = ArchiveFactory.Open(rd.Values.First());It works, for the whole files in the first volume. I can successfully use them and write them to disk.
What am I missing to be able to read the whole archive? Is this intended behavior or a bug?
@adamhathcock commented on GitHub (Apr 20, 2017):
It does work. Here's a relevant test: https://github.com/adamhathcock/sharpcompress/blob/master/test/SharpCompress.Test/Rar/RarArchiveTests.cs#L191
I would think it's because
Dictionary.Values.GetEnumeratordoesn't return any guaranteed order.@krvi commented on GitHub (Apr 22, 2017):
Thanks for the reply. My issue was a bit more embarrassing though; the streams' position was at the end.
It works fine now, with the generic collections that I have tried, List/Dictionary/SortedDictionary/OrderedDictionary etc. Extracts even if it's out of order! but split-files are understandably split, heh.
Thanks for a nice library.