From a3a0c17ee1bdb2370b149a266b77dc6d8e2dca81 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Tue, 30 Jun 2020 00:03:37 +0200 Subject: [PATCH] Dramatically improve startup speed when not using APK/IPA --- Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs index 1a4f65a..5ca1024 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs @@ -303,6 +303,12 @@ namespace Il2CppInspector // Returns null if package not recognized or does not contain an IL2CPP application public static (MemoryStream Metadata, MemoryStream Binary)? GetStreamsFromPackage(string packageFile) { try { + // Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't + using (BinaryReader zipTest = new BinaryReader(File.Open(packageFile, FileMode.Open))) { + if (zipTest.ReadUInt32() != 0x04034B50) + return null; + } + using ZipArchive zip = ZipFile.OpenRead(packageFile); Stream metadataStream, binaryStream;