1
0
mirror of synced 2024-12-11 23:36:01 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Compression/Formats/MtaCustomCmp.cs
2019-09-17 17:42:39 -04:00

43 lines
1.2 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 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();
return new MemoryStream(STLibraryCompression.MTA_CUSTOM.Decompress(stream.ToArray(), decompSize));
}
}
public Stream Compress(Stream stream)
{
return new MemoryStream();
}
}
}