1
0
mirror of synced 2024-12-11 07:16:05 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Compression/Formats/ZlibGZ.cs
KillzXGaming 0c126e4155 More improvements.
Rewrote the compression handling from scatch. It's way easier and cleaner to add new formats code wise as it's handled like file formats.
Added wip TVOL support (Touhou Azure Reflections)
Added XCI support. Note I plan to improve NSP, XCI, NCA, etc later for exefs exporting.
The compression rework now compresses via streams, so files get decompressed properly within archives as streams.
Added hyrule warriors bin.gz compression along with archive rebuilding. Note i do not have texture rebuilding done just yet.
2019-09-15 19:13:01 -04:00

39 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.IO.Compression;
using System.Threading.Tasks;
using Toolbox.Library.IO;
namespace Toolbox.Library
{
public class ZlibGZ : ICompressionFormat
{
public bool IsBigEndian = true;
public string[] Description { get; set; } = new string[] { "ZLIB GZ" };
public string[] Extension { get; set; } = new string[] { "*.gz", };
public bool Identify(Stream stream, string fileName)
{
if (Utils.GetExtension(fileName) != ".gz")
return false;
return STLibraryCompression.ZLIB_GZ.IsCompressed(stream);
}
public bool CanCompress { get; } = true;
public Stream Decompress(Stream stream)
{
return STLibraryCompression.ZLIB_GZ.Decompress(stream);
}
public Stream Compress(Stream stream)
{
return STLibraryCompression.ZLIB_GZ.Compress(stream, IsBigEndian);
}
}
}