From c8c9d4ac642dfb1bb9d881a1bd8b82cc2699b681 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 28 Oct 2020 12:23:25 -0700 Subject: [PATCH] Scan whole path for Wise --- BurnOutSharp/ProtectionType/WiseInstaller.cs | 22 +++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/BurnOutSharp/ProtectionType/WiseInstaller.cs b/BurnOutSharp/ProtectionType/WiseInstaller.cs index 39d9fe78..46d49cb6 100644 --- a/BurnOutSharp/ProtectionType/WiseInstaller.cs +++ b/BurnOutSharp/ProtectionType/WiseInstaller.cs @@ -39,22 +39,16 @@ namespace BurnOutSharp.ProtectionType Wise unpacker = new Wise(); unpacker.ExtractTo(file, tempPath); - foreach (string tempFile in Directory.EnumerateFiles(tempPath, "*", SearchOption.AllDirectories)) + // Collect and format all found protections + var fileProtections = ProtectionFind.Scan(tempPath, includePosition); + protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + + // If temp directory cleanup fails + try { - // Collect and format all found protections - var fileProtections = ProtectionFind.Scan(tempFile, includePosition); - string protection = string.Join("\r\n", fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd())); - - // If tempfile cleanup fails - try - { - File.Delete(tempFile); - } - catch { } - - if (!string.IsNullOrEmpty(protection)) - protections.Add($"\r\n{tempFile.Substring(tempPath.Length)} - {protection}"); + Directory.Delete(tempPath, true); } + catch { } } catch { }