I want my app to use files from a .7z file.
I have found some explanations of how to decompress a 7z file. However, they are all about a case I have not yet encountered in the wild: An archive that decompresses to a single file. I would expect a .7z archive to decompress to an arbitrary amount of files, possibly in arbitrary subfolders.
It seems like it would be possible to do this by including the whole 7zip application and then running that in a process. However, that seems like unnecessary extra steps, considering there's an official LZMA SDK. Also, it leads to problems concerning cross compatibility.
So, how can I unpack a .7z archive into a given folder, using in C# (.NET 3.5)?
Additional info from comments
"Please show the code that isn't working."
Well, at the moment I'm using the second half of this answer on another question. However, I'm expecting that to not do what I want - output
(just like input
) is a FileStream
, so it's clear that this only creates one file.
It shows that Decoder
is the class doing the decompressing, but it doesn't have a method that works with e.g. a DirectoryInfo
, a string
path or anything like that - it's all one file in, one file out. Every info I found on using the SDK does this very same thing; I haven't found a single one extracting an archive to several files.