From 8897fd8650ed2147c1b2806c3ab41759d9a0765e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 19 Mar 2021 15:56:07 -0700 Subject: [PATCH] Make SafeDisc more like Tages path check --- BurnOutSharp/ProtectionType/SafeDisc.cs | 19 ++++++++++++------- BurnOutSharp/Scanner.cs | 3 +-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index 0556f49c..42d4f334 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -63,28 +63,33 @@ namespace BurnOutSharp.ProtectionType /// public string CheckDirectoryPath(string path, IEnumerable files) { - // TODO: These are all cop-outs that don't check the existence of the other files + List protections = new List(); + if (files.Any(f => Path.GetFileName(f).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase))) { string file = files.First(f => Path.GetFileName(f).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase)); - return GetDPlayerXVersion(file); + protections.Add($"dplayerx.dll {GetDPlayerXVersion(file)}"); } else if (files.Any(f => Path.GetFileName(f).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase))) { string file = files.First(f => Path.GetFileName(f).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase)); - return GetDrvmgtVersion(file); + protections.Add($"drvmgt.dll {GetDrvmgtVersion(file)}"); } else if (files.Any(f => Path.GetFileName(f).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase))) { string file = files.First(f => Path.GetFileName(f).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase)); - return GetSecdrvVersion(file); + protections.Add($"secdrv.sys {GetSecdrvVersion(file)}"); } - else if (path.EndsWith(".SafeDiscDVD.bundle", StringComparison.OrdinalIgnoreCase)) + else if (path.Contains(".SafeDiscDVD.bundle") + || files.Any(f => f.Contains(".SafeDiscDVD.bundle"))) { - return "SafeDisc for Macintosh"; + protections.Add("SafeDisc for Macintosh"); } - return null; + if (protections.Count() == 0) + return null; + else + return string.Join(", ", protections); } /// diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs index 65808cde..f52da73d 100644 --- a/BurnOutSharp/Scanner.cs +++ b/BurnOutSharp/Scanner.cs @@ -174,7 +174,7 @@ namespace BurnOutSharp return protections; } - + /// /// Get the path-detectable protections associated with a single path /// @@ -182,7 +182,6 @@ namespace BurnOutSharp /// Files contained within /// Dictionary of list of strings representing the found protections private Dictionary> GetDirectoryPathProtections(string path, List files) - { // Create an empty list for protections List protections = new List();