HighTechTalks DotNet Forums  

Reading images from a zip with Ziplib

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss Reading images from a zip with Ziplib in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dominik Klein
 
Posts: n/a

Default Reading images from a zip with Ziplib - 12-22-2007 , 11:40 AM






Hi there,

I have a bunch of images stored in a zipfile that is stored on the device.

I'm trying to read the image out of the zip like this:

try
{
ZipFile zFile = new ZipFile(zipname);
ZipEntry currentEntry = zFile.GetEntry(filename);
if (currentEntry.Name != null)
{
Stream ImgInputStream = zFile.GetInputStream(currentEntry);
byte[] RawImage = new byte[currentEntry.Size];
ImgInputStream.Read(RawImage, 0,
Convert.ToInt32(currentEntry.Size));

MemoryStream MStream = new MemoryStream(RawImage);
animCtl.Bitmap = new Bitmap(MStream);

ImgInputStream.Close();
MStream.Close();
}
zFile.Close();

etc.

Now the operation completes successfully, however part of the image is
completely garbled and I have no clue why. I have some feeling that it
has something to do with the size of the image; small images can be read
easily, the bigger the image is there are problems.
I'm reading the Inputstream in one chunk, probably the memory card can't
deliver so fast and there are timouts or something.

Is there any simple way to deal with such timeouts? Or could the problem
result because of other reasons?

Thanks in advance,

Dominik

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.