From 3d27e02ac1a4434278bae1b5c414b7a9620be948 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Tue, 29 Apr 2025 13:42:47 -0500 Subject: [PATCH] Use Already Defined Helper Functions --- .../Serialization/Tmx/TmxReaderBase.Data.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Data.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Data.cs index 1566936..e60f641 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Data.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Data.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.IO.Compression; using System.Linq; using System.Xml; @@ -76,8 +75,8 @@ public abstract partial class TmxReaderBase var decompressed = compression.Value switch { - DataCompression.GZip => DecompressGZip(bytes), - DataCompression.ZLib => DecompressZLib(bytes), + DataCompression.GZip => Helpers.DecompressGZip(bytes), + DataCompression.ZLib => Helpers.DecompressZLib(bytes), DataCompression.ZStd => throw new NotSupportedException("ZStd compression is not supported."), _ => throw new XmlException("Invalid compression") }; @@ -105,16 +104,4 @@ public abstract partial class TmxReaderBase } return finalValues.ToArray(); } - - internal static uint[] DecompressGZip(MemoryStream stream) - { - using var decompressedStream = new GZipStream(stream, CompressionMode.Decompress); - return ReadMemoryStreamAsInt32Array(decompressedStream); - } - - internal static uint[] DecompressZLib(MemoryStream stream) - { - using var decompressedStream = new ZLibStream(stream, CompressionMode.Decompress); - return ReadMemoryStreamAsInt32Array(decompressedStream); - } }