1

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?

1 Answers1

2

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.

Yannick Blondeau
  • 9,465
  • 8
  • 52
  • 74