当前位置: 首页>>代码示例>>C#>>正文


C# DeflateStream.CopyTo方法代码示例

本文整理汇总了C#中Ionic.Zlib.DeflateStream.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# DeflateStream.CopyTo方法的具体用法?C# DeflateStream.CopyTo怎么用?C# DeflateStream.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ionic.Zlib.DeflateStream的用法示例。


在下文中一共展示了DeflateStream.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DecryptAes128CbcWithGzip

 private static byte[] DecryptAes128CbcWithGzip(byte[] data, byte[] key)
 {
     byte[] gzippedFile;
     using (var cipher = new AesManaged { Mode = CipherMode.CBC, Key = key })
         gzippedFile = cipher.CreateDecryptor().TransformFinalBlock(data, 0, data.Length).Skip(16).ToArray();
     using (var inStream = new MemoryStream(gzippedFile))
     using (var zipStream = new DeflateStream(inStream, CompressionMode.Decompress))
     using (var outStream = new MemoryStream())
     {
         zipStream.CopyTo(outStream);
         return outStream.ToArray();
     }
 }
开发者ID:13xforever,项目名称:DeDRM,代码行数:13,代码来源:Decryptor.cs

示例2: Decode

        /// <summary>
        /// Decode the content
        /// </summary>
        /// <param name="data">Content to decode</param>
        /// <returns>Decoded content</returns>
        public byte[] Decode(byte[] data)
        {
            var output = new MemoryStream ();
            var input = new MemoryStream (data);
            /*
            using (var stream = new System.IO.Compression.DeflateStream (input, System.IO.Compression.CompressionMode.Decompress))
                stream.CopyTo (output);
            return output.ToArray ();
            */

            using (var stream = new DeflateStream (input, CompressionMode.Decompress))
                stream.CopyTo (output);
            return output.ToArray ();
        }
开发者ID:alessandrofacchini,项目名称:ImagoPCL,代码行数:19,代码来源:testRestCompressed.cs

示例3: DecompressTileBlock

		public static void DecompressTileBlock(byte[] buffer, int bufferStart, int bufferLength)
		{
			using (MemoryStream memoryStream = new MemoryStream())
			{
				memoryStream.Write(buffer, bufferStart, bufferLength);
				memoryStream.Position = 0L;
				bool flag = memoryStream.ReadByte() != 0;
				MemoryStream memoryStream3;
				if (flag)
				{
					MemoryStream memoryStream2 = new MemoryStream();
					using (DeflateStream deflateStream = new DeflateStream((Stream)memoryStream, CompressionMode.Decompress, CompressionLevel.BestCompression))
					{
						deflateStream.CopyTo(memoryStream2);
						deflateStream.Close();
					}
					memoryStream3 = memoryStream2;
					memoryStream3.Position = 0L;
				}
				else
				{
					memoryStream3 = memoryStream;
					memoryStream3.Position = 1L;
				}
				using (BinaryReader binaryReader = new BinaryReader(memoryStream3))
				{
					int xStart = binaryReader.ReadInt32();
					int yStart = binaryReader.ReadInt32();
					short width = binaryReader.ReadInt16();
					short height = binaryReader.ReadInt16();
					NetMessage.DecompressTileBlock_Inner(binaryReader, xStart, yStart, (int)width, (int)height);
				}
			}
		}
开发者ID:thegamingboffin,项目名称:Ulterraria_Reborn_GitHub,代码行数:34,代码来源:NetMessage.cs

示例4: Decompress

        private static byte[] Decompress(byte[] data)
        {
            // While a "real" PNG uses Zlib for the image data, the CgBI PNG image data is compressed with Deflate.
            using (var inputStream = new MemoryStream(data, false))
            {
                using (var deflateStream = new DeflateStream(inputStream, CompressionMode.Decompress))
                {
                    using (var newData = new MemoryStream())
                    {
                        deflateStream.CopyTo(newData);
                        return newData.ToArray();
                    }
                }

            }
        }
开发者ID:osuritz,项目名称:PNGNormalizer,代码行数:16,代码来源:PngFile.cs


注:本文中的Ionic.Zlib.DeflateStream.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。