From 5bd3097be963f7edb8ba90eab5358135ee7fddc9 Mon Sep 17 00:00:00 2001 From: Perfare Date: Sun, 5 May 2019 00:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/Program.cs | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index ed7d36e..870a4ad 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -106,23 +106,28 @@ namespace Il2CppDumper var metadataVersion = BitConverter.ToInt32(metadataBytes, 4); if (metadataVersion == 24) { - Console.WriteLine("Input Unity version (Just enter the first two numbers eg. 5.6, 2017.1): "); + Console.WriteLine("Input Unity version (Just enter the first two numbers eg. *.*, ****.*): "); var str = Console.ReadLine(); - if (string.IsNullOrEmpty(str) || !str.Contains(".")) + try + { + var strs = Array.ConvertAll(str.Split('.'), int.Parse); + var unityVersion = new Version(strs[0], strs[1]); + if (unityVersion >= Unity20191) + { + fixedMetadataVersion = 24.2f; + } + else if (unityVersion >= Unity20183) + { + fixedMetadataVersion = 24.1f; + } + else + { + fixedMetadataVersion = metadataVersion; + } + } + catch + { throw new Exception("You must enter the correct Unity version number"); - var strs = Array.ConvertAll(str.Split('.'), int.Parse); - var unityVersion = new Version(strs[0], strs[1]); - if (unityVersion >= Unity20191) - { - fixedMetadataVersion = 24.2f; - } - else if (unityVersion >= Unity20183) - { - fixedMetadataVersion = 24.1f; - } - else - { - fixedMetadataVersion = metadataVersion; } } else