From 9855aa3b3f42a9dd9ca3664e4dea07ce9abe7c09 Mon Sep 17 00:00:00 2001 From: commonuserlol Date: Wed, 10 Jul 2024 19:32:02 +0300 Subject: [PATCH] Print banner only on windows TLDR: GetVersionInfo works only with PE Header Reference: https://stackoverflow.com/questions/63773485/c-sharp-fileversioninfo-getversioninfo-not-working-on-mac-os --- Il2CppInspector.CLI/Program.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index 9181b07..7cc7786 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -172,17 +172,18 @@ namespace Il2CppInspector.CLI } private static int Run(Options options) { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { + // Banner + var location = Assembly.GetEntryAssembly().Location; + if (location == "") // Single file executables don't have an assembly location + location = Path.Join(AppContext.BaseDirectory, "Il2CppInspector.exe"); - // Banner - var location = Assembly.GetEntryAssembly().Location; - if (location == "") // Single file executables don't have an assembly location - location = Path.Join(AppContext.BaseDirectory, "Il2CppInspector.exe"); - - var asmInfo = FileVersionInfo.GetVersionInfo(location); - Console.WriteLine(asmInfo.ProductName); - Console.WriteLine("Version " + asmInfo.ProductVersion); - Console.WriteLine(asmInfo.LegalCopyright); - Console.WriteLine(""); + var asmInfo = FileVersionInfo.GetVersionInfo(location); + Console.WriteLine(asmInfo.ProductName); + Console.WriteLine("Version " + asmInfo.ProductVersion); + Console.WriteLine(asmInfo.LegalCopyright); + Console.WriteLine(""); + } // Safe plugin manager load try {