Hi to all,
I am using ICSharpCode.SharpZipLib.Zip.
My zip file contains a number of images which when they get unzipped only
contain a partial image. The filesize looks correct.
The unziping is done below it is not clear where the problem is. For int
numberOfBytesToRead = (int) zipEntryObject.Size; I initially had the
int numberOfBytesToRead = (int) readStream.length but this always gave me
0.
foreach (ZipEntry zipEntryObject in zipFileObject)
{
System.IO.Stream readStream =
zipFileObject.GetInputStream(zipEntryObject);
int numberOfBytesToRead = (int) zipEntryObject.Size;
byte[] bytes = new byte[numberOfBytesToRead];
readStream.Read(bytes, 0, numberOfBytesToRead);
System.IO.FileStream outputStream =
new System.IO.FileStream(@Directory + zipEntryObject.Name,
System.IO.FileMode.Create);
outputStream.Write(bytes, 0, numberOfBytesToRead);
outputStream.Flush();
outputStream.Close();
}
Sham.