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 | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index 9181b077..7cc7786f 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -172,17 +172,18 @@ private static int DisplayHelp(ParserResult result, IEnumerable } private static int Run(Options options) { - - // 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(""); + 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"); + + 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 {