Hi everyone
I've got terrible problem with unziping binary files with ICSharpCode
library. I've tried to do it by the code below with jpg files. The
files are unziped but they are unreadable. I don't know what I have to
do. Maybe it's something wrong with library. Can anybody help me??
ZipInputStream unzip =
new ZipInputStream(File.OpenRead(@"c:\myFile.zip"));
ZipEntry entry;
while((entry = unzip.GetNextEntry()) != null)
{
FileStream s =
new FileStream(@"c:\test.jpg",FileMode.Create);
while(true)
{
size = unzip.Read(buffer,0,buffer.Length);
if(size > 0)
s.Write(buffer,0,buffer.Length);
else
break;
}
s.Close();
}
unzip.Close();
Baczek - 22 Jan 2006 20:26 GMT
Sorry it's me once again I made mistake when I wanted to show you my
code I deleted some not important information but I also deleted some
code that must be implemented. So I write code once again
ZipInputStream unzip = new
ZipInputStream(File.OpenRead(@"c:\myZip.zip"));
ZipEntry entry;
while((entry = unzip.GetNextEntry()) != null)
{
int size = 256;
byte[] buffer = new byte[256];
FileStream s = new FileStream(@"c:\test.jpg",FileMode.Create);
while(true)
{
size = unzip.Read(buffer,0,buffer.Length);
if(size > 0)
s.Write(buffer,0,buffer.Length);
else
break;
}
s.Close();
}
unzip.Close();
Sorry for this