mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-08 18:36:02 +03:00
Use Already Defined Helper Functions
This commit is contained in:
parent
fa6947e57d
commit
3d27e02ac1
1 changed files with 2 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
|
@ -76,8 +75,8 @@ public abstract partial class TmxReaderBase
|
||||||
|
|
||||||
var decompressed = compression.Value switch
|
var decompressed = compression.Value switch
|
||||||
{
|
{
|
||||||
DataCompression.GZip => DecompressGZip(bytes),
|
DataCompression.GZip => Helpers.DecompressGZip(bytes),
|
||||||
DataCompression.ZLib => DecompressZLib(bytes),
|
DataCompression.ZLib => Helpers.DecompressZLib(bytes),
|
||||||
DataCompression.ZStd => throw new NotSupportedException("ZStd compression is not supported."),
|
DataCompression.ZStd => throw new NotSupportedException("ZStd compression is not supported."),
|
||||||
_ => throw new XmlException("Invalid compression")
|
_ => throw new XmlException("Invalid compression")
|
||||||
};
|
};
|
||||||
|
@ -105,16 +104,4 @@ public abstract partial class TmxReaderBase
|
||||||
}
|
}
|
||||||
return finalValues.ToArray();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue