wuxianshengcong/Library/PackageCache/com.unity.2d.aseprite@1.1.6/Editor/Utilities/Zlib.cs

27 lines
778 B
C#
Raw Normal View History

2025-01-02 14:49:00 +08:00
using System.IO;
using System.IO.Compression;
namespace UnityEditor.U2D.Aseprite
{
internal static class Zlib
{
public static byte[] Decompress(byte[] compressedData)
{
byte[] decompressedData;
using (var decompressedStream = new MemoryStream())
{
using (var compressStream = new MemoryStream(compressedData))
{
using (var deflateStream = new DeflateStream(compressStream, CompressionMode.Decompress))
{
deflateStream.CopyTo(decompressedStream);
}
}
decompressedData = decompressedStream.ToArray();
}
return decompressedData;
}
}
}