2019-09-17 23:42:39 +02: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-18 01:30:07 +02:00
|
|
|
|
var acesComp = new STLibraryCompression.MTA_CUSTOM();
|
|
|
|
|
return new MemoryStream(acesComp.Decompress(stream.ToArray(), decompSize));
|
2019-09-17 23:42:39 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Stream Compress(Stream stream)
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|