mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-07 01:10:52 +00:00
70ea0658ed
GZDoom Builder now uses SharpCompress.dll instead of SharpZip.dll. Added PK7 archive support. PK3 archives now load aprox. 40% faster. Textures browser now shows Folder/PK3/PK7 folder structure. TextureBrowserForm is now used to display both Textures and Flats. ACS scripts from #include and #import directives are now shown in Script name/number dropdowns. Fixed several cases when ACS scripts lists used in Edit Thing and Edit Linedef forms wasn't updated when they should've (i.e. after compiling a script).
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using SharpCompress.Compressor;
|
|
using SharpCompress.Compressor.BZip2;
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|
{
|
|
internal static class SharpCompressHelper
|
|
{
|
|
internal static MemoryStream CompressStream(Stream stream) {
|
|
byte[] arr = new byte[stream.Length];
|
|
stream.Read(arr, 0, (int)stream.Length);
|
|
|
|
MemoryStream ms = new MemoryStream();
|
|
BZip2Stream bzip = new BZip2Stream(ms, CompressionMode.Compress, true);
|
|
|
|
bzip.Write(arr, 0, arr.Length);
|
|
bzip.Close();
|
|
|
|
return ms;
|
|
}
|
|
|
|
internal static MemoryStream DecompressStream(Stream stream) {
|
|
BZip2Stream bzip = new BZip2Stream(stream, CompressionMode.Decompress, false);
|
|
|
|
byte[] buffer = new byte[16 * 1024];
|
|
MemoryStream ms = new MemoryStream();
|
|
|
|
int read;
|
|
while ((read = bzip.Read(buffer, 0, buffer.Length)) > 0)
|
|
ms.Write(buffer, 0, read);
|
|
|
|
return ms;
|
|
}
|
|
}
|
|
}
|