Formats: Add DefaultFilename property

This commit is contained in:
Katy Coe
2020-12-09 17:34:38 +01:00
parent 90fa9cf193
commit 7e25fa9d1d
8 changed files with 18 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ namespace Il2CppInspector
public AABReader(Stream stream) : base(stream) { } public AABReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "Package.aab";
protected override bool Init() { protected override bool Init() {
// Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't // Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't

View File

@@ -20,6 +20,8 @@ namespace Il2CppInspector
public APKReader(Stream stream) : base(stream) { } public APKReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "Package.apk";
protected override bool Init() { protected override bool Init() {
// Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't // Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't

View File

@@ -115,6 +115,8 @@ namespace Il2CppInspector
public ElfReader(Stream stream) : base(stream) { } public ElfReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "libil2cpp.so";
public override string Format => Bits == 32 ? "ELF" : "ELF64"; public override string Format => Bits == 32 ? "ELF" : "ELF64";
public override string Arch => (Elf) elf_header.e_machine switch { public override string Arch => (Elf) elf_header.e_machine switch {

View File

@@ -20,6 +20,7 @@ namespace Il2CppInspector
double Version { get; set; } double Version { get; set; }
long Length { get; } long Length { get; }
uint NumImages { get; } uint NumImages { get; }
string DefaultFilename { get; }
IEnumerable<IFileFormatReader> Images { get; } IEnumerable<IFileFormatReader> Images { get; }
IFileFormatReader this[uint index] { get; } IFileFormatReader this[uint index] { get; }
long Position { get; set; } long Position { get; set; }
@@ -122,6 +123,8 @@ namespace Il2CppInspector
public BinaryObjectReader Stream => this; public BinaryObjectReader Stream => this;
public abstract string DefaultFilename { get; }
public long Length => BaseStream.Length; public long Length => BaseStream.Length;
public uint NumImages { get; protected set; } = 1; public uint NumImages { get; protected set; } = 1;

View File

@@ -77,6 +77,8 @@ namespace Il2CppInspector
protected MachOReader(Stream stream) : base(stream) { } protected MachOReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "app";
public override string Format => "Mach-O " + (Bits == 32 ? "32-bit" : "64-bit"); public override string Format => "Mach-O " + (Bits == 32 ? "32-bit" : "64-bit");
public override string Arch => (MachO)header.CPUType switch public override string Arch => (MachO)header.CPUType switch

View File

@@ -23,6 +23,9 @@ namespace Il2CppInspector
public PEReader(Stream stream) : base(stream) {} public PEReader(Stream stream) : base(stream) {}
public override string DefaultFilename => "GameAssembly.dll";
public override string Format => pe is PEOptHeader32 ? "PE32" : "PE32+"; public override string Format => pe is PEOptHeader32 ? "PE32" : "PE32+";
public override string Arch => coff.Machine switch { public override string Arch => coff.Machine switch {

View File

@@ -28,6 +28,8 @@ namespace Il2CppInspector
{ {
public SElfReader(Stream stream) : base(stream) { } public SElfReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "libil2cpp.so";
public override string Format => sceData.ProductType == (ulong) SElfExInfoTypes.PTYPE_FAKE? "FSELF" : "SELF"; public override string Format => sceData.ProductType == (ulong) SElfExInfoTypes.PTYPE_FAKE? "FSELF" : "SELF";
public override string Arch => "x64"; public override string Arch => "x64";

View File

@@ -15,6 +15,8 @@ namespace Il2CppInspector
public UBReader(Stream stream) : base(stream) { } public UBReader(Stream stream) : base(stream) { }
public override string DefaultFilename => "app";
protected override bool Init() { protected override bool Init() {
// Fat headers are always big-endian regardless of architectures // Fat headers are always big-endian regardless of architectures
Endianness = Endianness.Big; Endianness = Endianness.Big;