DotNetZip Download Address: http://dotnetzip.codeplex.com/
 
Compression:
 
 
  
   
   |   code is as follows  |  
    copy code  |  
  
 
   
   |   //define File path   string filename = @ "D:/test.rar";       using (zipfile zip = new ZipFile ())       {      zip. AddFile (@ "c:/text.txt", "txt");//store text files in txt folder       zip. AddFile (@ "C:/readme.txt");//The ReadMe file is stored in a more directory       zip. AddFile (@ "c:/test.jpg", "Images");//store test file in Images folder  }      Extract:      using (zipfile zip = new Zipfi Le (filename)   {      zip. Extractall ("D:\\test", extractexistingfileaction.overwritesilently);  }    |  
  
 
  
 
  
 
 
 
  
   
   |   code is as follows  |  
    copy code  |  
  
 
   
   |     /////// Replace the content   String str2 = System.Text.Encoding.GetEncoding ("GB2312"). GetString (buf, start, maxlength);   return str2;   ////////////////////////replaced content  //int i;  //char[] C = new Char[maxlength];  //for (i = 0; (I < maxlength) && (i < buf.) Length) && (Buf[i]!= 0); i++)  //{ //    c[i] = (char) buf[i];//System.BitConverter.ToChar (BUF, start+i*2);  //}  // string s = new System.String (c, 0, I);  //return S;  ////////////////////////   |  
  
 
  
 
 This method to the effect is that the byte array into a character array, the encoding of Chinese characters into two characters, which obviously will result in garbled, since the encoding using GetBytes, then the decoding is used to reverse, getstring on the line, compile run, finished