mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-08 18:26:03 +03:00
Merge 60d5318348
into 7f78a971f9
This commit is contained in:
commit
78bb645019
3 changed files with 17 additions and 1 deletions
|
@ -26,4 +26,8 @@
|
||||||
<None Include="../../LICENSE" Pack="true" PackagePath="" />
|
<None Include="../../LICENSE" Pack="true" PackagePath="" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ZstdSharp.Port" Version="0.8.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -46,6 +46,12 @@ internal static partial class Helpers
|
||||||
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static uint[] DecompressZStd(MemoryStream stream)
|
||||||
|
{
|
||||||
|
using var decompressedStream = new ZstdSharp.DecompressionStream(stream);
|
||||||
|
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
||||||
|
}
|
||||||
|
|
||||||
internal static uint[] ReadBytesAsInt32Array(byte[] bytes)
|
internal static uint[] ReadBytesAsInt32Array(byte[] bytes)
|
||||||
{
|
{
|
||||||
var intArray = new uint[bytes.Length / 4];
|
var intArray = new uint[bytes.Length / 4];
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract partial class TmxReaderBase
|
||||||
{
|
{
|
||||||
DataCompression.GZip => DecompressGZip(bytes),
|
DataCompression.GZip => DecompressGZip(bytes),
|
||||||
DataCompression.ZLib => DecompressZLib(bytes),
|
DataCompression.ZLib => DecompressZLib(bytes),
|
||||||
DataCompression.ZStd => throw new NotSupportedException("ZStd compression is not supported."),
|
DataCompression.ZStd => DecompressZStd(bytes),
|
||||||
_ => throw new XmlException("Invalid compression")
|
_ => throw new XmlException("Invalid compression")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,4 +117,10 @@ public abstract partial class TmxReaderBase
|
||||||
using var decompressedStream = new ZLibStream(stream, CompressionMode.Decompress);
|
using var decompressedStream = new ZLibStream(stream, CompressionMode.Decompress);
|
||||||
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static uint[] DecompressZStd(MemoryStream stream)
|
||||||
|
{
|
||||||
|
using var decompressedStream = new ZstdSharp.DecompressionStream(stream);
|
||||||
|
return ReadMemoryStreamAsInt32Array(decompressedStream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue