public static byte[] GzipExpandInternal(bool bUseXceed, byte[] compressedData) { if ((compressedData == null) || (compressedData.Length == 0)) { return(new byte[0]); } MemoryStream inner = new MemoryStream(compressedData); MemoryStream stream2 = new MemoryStream(compressedData.Length); if (bUseXceed) { using (GZipCompressedStream stream3 = new GZipCompressedStream(inner, CompressionLevel.Normal, false, false)) { byte[] buffer = new byte[0x8000]; int count = 0; while ((count = stream3.Read(buffer, 0, buffer.Length)) > 0) { stream2.Write(buffer, 0, count); } goto Label_00AE; } } using (GZipStream stream4 = new GZipStream(inner, CompressionMode.Decompress)) { byte[] buffer2 = new byte[0x8000]; int num2 = 0; while ((num2 = stream4.Read(buffer2, 0, buffer2.Length)) > 0) { stream2.Write(buffer2, 0, num2); } } Label_00AE: return(stream2.ToArray()); }
////[CodeDescription("Returns a byte[] containing a gzip-compressed copy of writeData[]")] public static byte[] GzipCompress(byte[] writeData) { try { MemoryStream inner = new MemoryStream(); using (GZipCompressedStream stream2 = new GZipCompressedStream(inner)) { stream2.Write(writeData, 0, writeData.Length); } return(inner.ToArray()); } catch (Exception exception) { Comman.WriteLog("The content could not be compressed.\n\n" + exception.Message + "Fiddler: GZip failed"); return(writeData); } }
public static byte[] GzipExpandInternal(bool bUseXceed, byte[] compressedData) { if ((compressedData == null) || (compressedData.Length == 0)) { return new byte[0]; } MemoryStream inner = new MemoryStream(compressedData); MemoryStream stream2 = new MemoryStream(compressedData.Length); if (bUseXceed) { using (GZipCompressedStream stream3 = new GZipCompressedStream(inner, CompressionLevel.Normal, false, false)) { byte[] buffer = new byte[0x8000]; int count = 0; while ((count = stream3.Read(buffer, 0, buffer.Length)) > 0) { stream2.Write(buffer, 0, count); } goto Label_00AE; } } using (GZipStream stream4 = new GZipStream(inner, CompressionMode.Decompress)) { byte[] buffer2 = new byte[0x8000]; int num2 = 0; while ((num2 = stream4.Read(buffer2, 0, buffer2.Length)) > 0) { stream2.Write(buffer2, 0, num2); } } Label_00AE: return stream2.ToArray(); }
////[CodeDescription("Returns a byte[] containing a gzip-compressed copy of writeData[]")] public static byte[] GzipCompress(byte[] writeData) { try { MemoryStream inner = new MemoryStream(); using (GZipCompressedStream stream2 = new GZipCompressedStream(inner)) { stream2.Write(writeData, 0, writeData.Length); } return inner.ToArray(); } catch (Exception exception) { Comman.WriteLog("The content could not be compressed.\n\n" + exception.Message+"Fiddler: GZip failed"); return writeData; } }