mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
0c126e4155
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.
70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Toolbox.Library.IO;
|
|
|
|
namespace Toolbox.Library
|
|
{
|
|
public enum FileType
|
|
{
|
|
Default,
|
|
Image,
|
|
Archive,
|
|
Layout,
|
|
Model,
|
|
Effect,
|
|
Font,
|
|
Audio,
|
|
Message,
|
|
Resource,
|
|
Shader,
|
|
Collision,
|
|
Parameter,
|
|
Graphic,
|
|
Rom,
|
|
Spreadsheet,
|
|
Animation,
|
|
}
|
|
|
|
/// <summary>
|
|
/// A common file format interface used to load, edit and save file formats
|
|
/// </summary>
|
|
public interface IFileFormat
|
|
{
|
|
FileType FileType { get; set; }
|
|
|
|
bool CanSave { get; set; }
|
|
|
|
string[] Description { get; set; }
|
|
|
|
string[] Extension { get; set; }
|
|
|
|
Type[] Types { get; } //Types hold menu extensions
|
|
|
|
string FileName { get; set; }
|
|
string FilePath { get; set; }
|
|
|
|
bool Identify(System.IO.Stream stream);
|
|
void Load(System.IO.Stream stream);
|
|
void Save(System.IO.Stream stream);
|
|
|
|
void Unload();
|
|
IFileInfo IFileInfo { get; set; }
|
|
}
|
|
public class IFileInfo
|
|
{
|
|
public ICompressionFormat FileCompression { get; set; }
|
|
public IArchiveFile ArchiveParent { get; set; }
|
|
public bool FileIsCompressed { get; set; }
|
|
public bool FileIsEdited { get; set; }
|
|
public bool UseEditMenu { get; set; }
|
|
public virtual bool IsActive { get; set; }
|
|
public virtual bool InArchive { get; set; }
|
|
public virtual int Alignment { get; set; } //Alignment to save the file back. Also used for Yaz0 comp sometimes
|
|
public virtual uint DecompressedSize { get; set; }
|
|
public virtual uint CompressedSize { get; set; }
|
|
}
|
|
}
|