Switch-Toolbox/Switch_Toolbox_Library/Compression/Formats/MtaCustomCmp.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2019-09-17 21:42:39 +00:00
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 MtaCustomCmp : ICompressionFormat
{
public int Alignment = 0;
public string[] Description { get; set; } = new string[] { "Mario Tennis Custom" };
public string[] Extension { get; set; } = new string[] { "*.cbtx", };
public override string ToString() { return "Mario Tennis Custom"; }
public bool Identify(Stream stream, string fileName)
{
return Utils.GetExtension(fileName) == ".cbtx";
}
public bool CanCompress { get; } = false;
public Stream Decompress(Stream stream)
{
using (var reader = new FileReader(stream, true))
{
reader.SeekBegin(4);
uint decompSize = reader.ReadUInt32();
2019-09-17 23:30:07 +00:00
var acesComp = new STLibraryCompression.MTA_CUSTOM();
return new MemoryStream(acesComp.Decompress(stream.ToArray(), decompSize));
2019-09-17 21:42:39 +00:00
}
}
public Stream Compress(Stream stream)
{
return new MemoryStream();
}
}
}