Question

My app loads RAR/ZIP archives that contain a large number of images and displays a thumbnail in a Listbox. I'm using SevenZipSharp at the moment. Afaik it only supports dumping individual files to disk - which I'll have to do for each image to get a thumbnail. I think dumping the images to memory will give me at least some improvement in performance. Any ideas how to do that?

Était-ce utile?

La solution

In SevenZipSharp source code, you can see that there are two SevenZipExtractor.ExtractFile() overloads that takes a System.IO.Stream object as input type:

public void ExtractFile(string fileName, Stream stream)
// and
public void ExtractFile(int index, Stream stream) // 'index' is the index in the archive file table.

As MemoryStream inherits from Stream, you can use one of these functions to achieve what you want.

Note: SevenZipExtractor has constructors that accept Stream object also as input type.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top