Пример #1
0
 private void DecompressStream(Stream outputStream, Stream inputStream)
 {
     #region radziplibrary-compress-stream_2
     using (CompressedStream compressedStream = new CompressedStream(inputStream, StreamOperationMode.Read, new DeflateSettings()))
     {
         compressedStream.CopyTo(outputStream);
     }
     #endregion
 }
Пример #2
0
        string GetSentCommand()
        {
            if (!commands[index].Compressed)
            {
                return(Latin1.GetString(sent.GetBuffer(), 0, (int)sent.Length));
            }

            using (var memory = new MemoryStream(sent.GetBuffer(), 0, (int)sent.Length)) {
                using (var compressed = new CompressedStream(memory)) {
                    using (var decompressed = new MemoryStream()) {
                        compressed.CopyTo(decompressed, 4096);

                        return(Latin1.GetString(decompressed.GetBuffer(), 0, (int)decompressed.Length));
                    }
                }
            }
        }