문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top