From f93bdad9af5c40c39b4bcd3cf02ba1d2a4d9620c Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Tue, 6 Apr 2021 22:22:27 -0500 Subject: [PATCH] Delay scan of IPA.exe until just before it would be run --- IPA.Injector/Updates.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/IPA.Injector/Updates.cs b/IPA.Injector/Updates.cs index 754b13f9..ee9ec1de 100644 --- a/IPA.Injector/Updates.cs +++ b/IPA.Injector/Updates.cs @@ -34,23 +34,23 @@ namespace IPA.Injector var path = Path.Combine(UnityGame.InstallPath, "IPA.exe"); if (!File.Exists(path)) return; - var scanResult = AntiMalwareEngine.Engine.ScanFile(new FileInfo(path)); - if (scanResult == ScanResult.Detected) - { - updater.Error("Scan of BSIPA installer found malware; not updating"); - return; - } - if (!SelfConfig.AntiMalware_.RunPartialThreatCode_ && scanResult is not ScanResult.KnownSafe and not ScanResult.NotDetected) - { - updater.Error("Scan of BSIPA installer returned partial threat; not updating. To allow this, enable AntiMalware.RunPartialThreatCode in the config."); - return; - } - var ipaVersion = new Version(FileVersionInfo.GetVersionInfo(path).FileVersion); var selfVersion = Assembly.GetExecutingAssembly().GetName().Version; if (ipaVersion > selfVersion) { + var scanResult = AntiMalwareEngine.Engine.ScanFile(new FileInfo(path)); + if (scanResult == ScanResult.Detected) + { + updater.Error("Scan of BSIPA installer found malware; not updating"); + return; + } + if (!SelfConfig.AntiMalware_.RunPartialThreatCode_ && scanResult is not ScanResult.KnownSafe and not ScanResult.NotDetected) + { + updater.Error("Scan of BSIPA installer returned partial threat; not updating. To allow this, enable AntiMalware.RunPartialThreatCode in the config."); + return; + } + _ = Process.Start(new ProcessStartInfo { FileName = path,