Code:
#regionExtract/// <summary>///Unzip/// </summary> Public voidUnZip (stringZippath,stringTargetPath) { using(FileStream Fszip =NewFileStream (Zippath, FileMode.Open, FileAccess.Read)) { using(Zipinputstream Zipinputstream =NewZipinputstream (Fszip)) {ZipEntry zipentry; while((ZipEntry = Zipinputstream.getnextentry ())! =NULL) { if(zipentry.isdirectory) {directory.createdirectory (Path.Combine (TargetPath, Zipentr Y.name)); } Else { if(Zipentry.name! =String.Empty) {//unzip the file to the specified directory using(FileStream fsfile =NewFileStream (Path.Combine (TargetPath, Zipentry.name), FileMode.Create, FileAccess.Write)) { intsize; byte[] data =New byte[1024x768*1024x768]; while(size = zipinputstream.read (data,0, data. Length)) >0) {fsfile.write (data,0, size); } } } } }//End While } }}#endregionView Code
C # Unzip the file