示例#1
0
 /// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.Compression.DeflateStream" /> and optionally releases the managed resources.</summary>
 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && !this.disposed)
     {
         this.disposed = true;
         IntPtr intPtr = this.z_stream;
         this.z_stream = IntPtr.Zero;
         int result = 0;
         if (intPtr != IntPtr.Zero)
         {
             result = DeflateStream.CloseZStream(intPtr);
         }
         this.io_buffer = null;
         if (!this.leaveOpen)
         {
             Stream stream = this.base_stream;
             if (stream != null)
             {
                 stream.Close();
             }
             this.base_stream = null;
         }
         DeflateStream.CheckResult(result, "Dispose");
     }
     if (this.data.IsAllocated)
     {
         this.data.Free();
         this.data = default(GCHandle);
     }
     base.Dispose(disposing);
 }