private void ProcessResponse(IMessage message, ITransportHeaders headers, ref Stream stream, object state) { if (state != null) { if (headers != null) { //Comprimir y marcar la cabecera. Compresion compresor = new Compresion(stream, m_CompressionMethod); Stream comprimido = compresor.ToStream; if (comprimido != null) { if (comprimido.Length < stream.Length) { headers["edonkeyCompress"] = "Yes"; headers["TamañoComprimido"] = comprimido.Length; headers["Tamaño"] = stream.Length; headers["CompressionType"] = (int)compresor.CompressionProvider; stream = comprimido; } } } } }
private void ProcessRequest(IMessage message, ITransportHeaders headers, ref Stream stream, ref object state) { state = true; if (headers!=null) { //Compare the requests Compresion compressor=new Compresion(stream, m_CompressionMethod ); Stream compressed=compressor.ToStream; if (compressed != null) { if (compressed.Length < stream.Length) { headers["edonkeyCompress"] = "Yes"; headers["CompressedSize"]=compressed.Length; headers["Compressed"]=stream.Length; headers["CompressionType"]= (int)compressor.CompressionProvider; stream=compressed; } } } }