예제 #1
0
 public static byte[] Decompress(this FileInfo destFile)
 {
     using (var fileStream = destFile.OpenRead())
         using (var compressionStream = new DeflateStream(fileStream, CompressionMode.Decompress))
         {
             return(compressionStream.ReadToEnd());
         }
 }
예제 #2
0
 /// <summary> РазЖать массив с использование DeflateStream</summary>
 /// <param name = "data"> массив </param>
 public static byte[] DeCompress(this byte[] data)
 {
     if (data == null)
     {
         return(data);
     }
     using (var ds = new DeflateStream(new MemoryStream(data, false), CompressionMode.Decompress))
     {
         try
         {
             return(ds.ReadToEnd());
         }
         catch//(InvalidDataException)
         {
             return(data);
         }
     }
 }
예제 #3
0
 public static byte[] DecompressDeflate(this byte[] @this)
 {
     using (var ms = new MemoryStream(@this))
         using (var stream = new DeflateStream(ms, CompressionMode.Decompress))
             return(stream.ReadToEnd());
 }
예제 #4
0
 public static byte[] DecompressDeflate(this Stream @this)
 {
     using (var stream = new DeflateStream(@this, CompressionMode.Decompress, true))
         return(stream.ReadToEnd());
 }