diff --git a/BurnOutSharp/FileType/BFPK.cs b/BurnOutSharp/FileType/BFPK.cs index 776882a8..91257d3d 100644 --- a/BurnOutSharp/FileType/BFPK.cs +++ b/BurnOutSharp/FileType/BFPK.cs @@ -97,7 +97,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/BZip2.cs b/BurnOutSharp/FileType/BZip2.cs index e06a1486..5b5289e9 100644 --- a/BurnOutSharp/FileType/BZip2.cs +++ b/BurnOutSharp/FileType/BZip2.cs @@ -40,7 +40,7 @@ namespace BurnOutSharp.FileType // 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())); + string protection = string.Join("\r\n", fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd())); // If tempfile cleanup fails try diff --git a/BurnOutSharp/FileType/GZIP.cs b/BurnOutSharp/FileType/GZIP.cs index 5c88ef4e..1d9f0414 100644 --- a/BurnOutSharp/FileType/GZIP.cs +++ b/BurnOutSharp/FileType/GZIP.cs @@ -43,7 +43,7 @@ namespace BurnOutSharp.FileType // 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())); + string protection = string.Join("\r\n", fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd())); // If tempfile cleanup fails try diff --git a/BurnOutSharp/FileType/InstallShieldCAB.cs b/BurnOutSharp/FileType/InstallShieldCAB.cs index c7e588c3..66d58de4 100644 --- a/BurnOutSharp/FileType/InstallShieldCAB.cs +++ b/BurnOutSharp/FileType/InstallShieldCAB.cs @@ -56,7 +56,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/MPQ.cs b/BurnOutSharp/FileType/MPQ.cs index b0f65d8b..d2254cd4 100644 --- a/BurnOutSharp/FileType/MPQ.cs +++ b/BurnOutSharp/FileType/MPQ.cs @@ -54,7 +54,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/MicrosoftCAB.cs b/BurnOutSharp/FileType/MicrosoftCAB.cs index 5c1f213a..2f91e93b 100644 --- a/BurnOutSharp/FileType/MicrosoftCAB.cs +++ b/BurnOutSharp/FileType/MicrosoftCAB.cs @@ -42,7 +42,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/PKZIP.cs b/BurnOutSharp/FileType/PKZIP.cs index 74086622..cd8fe2bc 100644 --- a/BurnOutSharp/FileType/PKZIP.cs +++ b/BurnOutSharp/FileType/PKZIP.cs @@ -55,7 +55,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/RAR.cs b/BurnOutSharp/FileType/RAR.cs index bc249405..06addf81 100644 --- a/BurnOutSharp/FileType/RAR.cs +++ b/BurnOutSharp/FileType/RAR.cs @@ -51,7 +51,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/SevenZip.cs b/BurnOutSharp/FileType/SevenZip.cs index f231f7b3..0c91d2df 100644 --- a/BurnOutSharp/FileType/SevenZip.cs +++ b/BurnOutSharp/FileType/SevenZip.cs @@ -46,7 +46,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/TapeArchive.cs b/BurnOutSharp/FileType/TapeArchive.cs index 6c4856f8..8e160400 100644 --- a/BurnOutSharp/FileType/TapeArchive.cs +++ b/BurnOutSharp/FileType/TapeArchive.cs @@ -49,7 +49,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/Valve.cs b/BurnOutSharp/FileType/Valve.cs index 388067b4..ef467753 100644 --- a/BurnOutSharp/FileType/Valve.cs +++ b/BurnOutSharp/FileType/Valve.cs @@ -54,7 +54,7 @@ namespace BurnOutSharp.FileType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try diff --git a/BurnOutSharp/FileType/XZ.cs b/BurnOutSharp/FileType/XZ.cs index 092de2ed..e8daf6b1 100644 --- a/BurnOutSharp/FileType/XZ.cs +++ b/BurnOutSharp/FileType/XZ.cs @@ -39,7 +39,7 @@ namespace BurnOutSharp.FileType // 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())); + string protection = string.Join("\r\n", fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd())); // If tempfile cleanup fails try diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs index 867f39d2..8b50a2ac 100644 --- a/BurnOutSharp/ProtectionFind.cs +++ b/BurnOutSharp/ProtectionFind.cs @@ -62,19 +62,28 @@ namespace BurnOutSharp // Checkpoint FileProgress?.Report(new FileProtection(null, 0, null)); + // Temp variables for reporting + string tempFilePath = Path.GetTempPath(); + string tempFilePathWithGuid = Path.Combine(tempFilePath, Guid.NewGuid().ToString()); + // If we have a file if (File.Exists(path)) { // Set total Total = 1; + // Get the reportable file name + string reportableFileName = path; + if (reportableFileName.StartsWith(tempFilePath)) + reportableFileName = reportableFileName.Substring(tempFilePathWithGuid.Length); + // Try using just the file first to get protection info string fileProtection = ScanPath(path, false); if (!string.IsNullOrWhiteSpace(fileProtection)) protections[path] = fileProtection; // Checkpoint - FileProgress?.Report(new FileProtection(path, 1, "Checking file")); + FileProgress?.Report(new FileProtection(reportableFileName, 1, "Checking file")); // Now check to see if the file contains any additional information string contentProtection = ScanContent(path, includePosition)?.Replace("" + (char)0x00, ""); @@ -88,7 +97,7 @@ namespace BurnOutSharp // Checkpoint protections.TryGetValue(path, out string fullProtection); - FileProgress?.Report(new FileProtection(path, 1, fullProtection ?? string.Empty)); + FileProgress?.Report(new FileProtection(reportableFileName, 1, fullProtection ?? string.Empty)); } // If we have a directory else if (Directory.Exists(path)) @@ -113,8 +122,13 @@ namespace BurnOutSharp // Get the current file string file = files.ElementAt(i); + // Get the reportable file name + string reportableFileName = file; + if (reportableFileName.StartsWith(tempFilePath)) + reportableFileName = reportableFileName.Substring(tempFilePathWithGuid.Length); + // Checkpoint - FileProgress?.Report(new FileProtection(file, i / (float)files.Count(), "Checking file")); + FileProgress?.Report(new FileProtection(reportableFileName, i / (float)files.Count(), "Checking file")); // Try using just the file first to get protection info string fileProtection = ScanPath(file, false); @@ -133,7 +147,7 @@ namespace BurnOutSharp // Checkpoint protections.TryGetValue(file, out string fullProtection); - FileProgress?.Report(new FileProtection(file, i / (float)files.Count(), fullProtection ?? string.Empty)); + FileProgress?.Report(new FileProtection(reportableFileName, i / (float)files.Count(), fullProtection ?? string.Empty)); } } diff --git a/BurnOutSharp/ProtectionType/WiseInstaller.cs b/BurnOutSharp/ProtectionType/WiseInstaller.cs index 46d49cb6..a9757bc8 100644 --- a/BurnOutSharp/ProtectionType/WiseInstaller.cs +++ b/BurnOutSharp/ProtectionType/WiseInstaller.cs @@ -41,7 +41,7 @@ namespace BurnOutSharp.ProtectionType // Collect and format all found protections var fileProtections = ProtectionFind.Scan(tempPath, includePosition); - protections = fileProtections.Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()).ToList(); + protections = fileProtections.Select(kvp => kvp.Key.Substring(tempPath.Length) + ": " + kvp.Value.TrimEnd()).ToList(); // If temp directory cleanup fails try