diff --git a/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs b/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
index 3c3be189..a52727bb 100644
--- a/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
+++ b/BurnOutSharp/ProtectionType/ProtectDVDVideo.cs
@@ -4,6 +4,7 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
+ // TODO: Figure out how to use path check framework here
public class ProtectDVDVideo : IPathCheck
{
///
diff --git a/BurnOutSharp/ProtectionType/SafeCast.cs b/BurnOutSharp/ProtectionType/SafeCast.cs
index 0f309e9a..2035fb90 100644
--- a/BurnOutSharp/ProtectionType/SafeCast.cs
+++ b/BurnOutSharp/ProtectionType/SafeCast.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,19 +8,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase)))
- return "SafeCast";
-
- return null;
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("cdac11ba.exe", useEndsWith: true), "SafeCast"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase))
- return "SafeCast";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("cdac11ba.exe", useEndsWith: true), "SafeCast"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs
index b83dae0f..b6eb4456 100644
--- a/BurnOutSharp/ProtectionType/SafeDisc.cs
+++ b/BurnOutSharp/ProtectionType/SafeDisc.cs
@@ -8,6 +8,7 @@ using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
+ // TODO: Figure out how to use path check framework here
public class SafeDisc : IContentCheck, IPathCheck
{
///
diff --git a/BurnOutSharp/ProtectionType/SafeDiscLite.cs b/BurnOutSharp/ProtectionType/SafeDiscLite.cs
index 675726db..cce1ab50 100644
--- a/BurnOutSharp/ProtectionType/SafeDiscLite.cs
+++ b/BurnOutSharp/ProtectionType/SafeDiscLite.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,19 +8,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase)))
- return "SafeDisc Lite";
-
- return null;
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("00000001.LT1", useEndsWith: true), "SafeDisc Lite"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase))
- return "SafeDisc Lite";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("00000001.LT1", useEndsWith: true), "SafeDisc Lite"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs
index 15fd9bbf..0c14b02b 100644
--- a/BurnOutSharp/ProtectionType/SafeLock.cs
+++ b/BurnOutSharp/ProtectionType/SafeLock.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
@@ -27,27 +24,28 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("SafeLock.dat", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SafeLock.001", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SafeLock.128", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "SafeLock";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("SafeLock.dat", useEndsWith: true), "SafeLock"),
+ new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"),
+ new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("SafeLock.dat", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SafeLock.001", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SafeLock.128", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "SafeLock";
- }
+ new PathMatchSet(new PathMatch("SafeLock.dat", useEndsWith: true), "SafeLock"),
+ new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"),
+ new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs
index ba5384f5..57970fa3 100644
--- a/BurnOutSharp/ProtectionType/SecuROM.cs
+++ b/BurnOutSharp/ProtectionType/SecuROM.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
-using System.Linq;
using System.Text;
using BurnOutSharp.Matching;
@@ -55,44 +53,42 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- // TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("CMS16.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("CMS_95.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("CMS_NT.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("CMS32_95.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("CMS32_NT.DLL", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "SecuROM";
- }
- else if (files.Any(f => Path.GetFileName(f).Equals("SINTF32.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SINTF16.DLL", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SINTFNT.DLL", StringComparison.OrdinalIgnoreCase)))
- {
- return "SecuROM New";
- }
-
- return null;
+ // TODO: Verify if these are OR or AND
+ new PathMatchSet(new PathMatch("CMS16.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS_95.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS_NT.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS32_95.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS32_NT.DLL", useEndsWith: true), "SecuROM"),
+
+ // TODO: Verify if these are OR or AND
+ new PathMatchSet(new PathMatch("SINTF32.DLL", useEndsWith: true), "SecuROM New"),
+ new PathMatchSet(new PathMatch("SINTF16.DLL", useEndsWith: true), "SecuROM New"),
+ new PathMatchSet(new PathMatch("SINTFNT.DLL", useEndsWith: true), "SecuROM New"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("CMS16.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("CMS_95.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("CMS_NT.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("CMS32_95.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("CMS32_NT.DLL", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "SecuROM";
- }
- else if (Path.GetFileName(path).Equals("SINTF32.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SINTF16.DLL", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SINTFNT.DLL", StringComparison.OrdinalIgnoreCase))
- {
- return "SecuROM New";
- }
+ new PathMatchSet(new PathMatch("CMS16.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS_95.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS_NT.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS32_95.DLL", useEndsWith: true), "SecuROM"),
+ new PathMatchSet(new PathMatch("CMS32_NT.DLL", useEndsWith: true), "SecuROM"),
- return null;
+ new PathMatchSet(new PathMatch("SINTF32.DLL", useEndsWith: true), "SecuROM New"),
+ new PathMatchSet(new PathMatch("SINTF16.DLL", useEndsWith: true), "SecuROM New"),
+ new PathMatchSet(new PathMatch("SINTFNT.DLL", useEndsWith: true), "SecuROM New"),
+ };
+
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
public static string GetV4Version(string file, byte[] fileContent, List positions)
diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs
index f0206c2e..13b1ee4f 100644
--- a/BurnOutSharp/ProtectionType/SmartE.cs
+++ b/BurnOutSharp/ProtectionType/SmartE.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
@@ -27,25 +24,26 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "SmartE";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("00001.TMP", useEndsWith: true), "SmartE"),
+ new PathMatchSet(new PathMatch("00002.TMP", useEndsWith: true), "SmartE"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "SmartE";
- }
+ new PathMatchSet(new PathMatch("00001.TMP", useEndsWith: true), "SmartE"),
+ new PathMatchSet(new PathMatch("00002.TMP", useEndsWith: true), "SmartE"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SoftLock.cs b/BurnOutSharp/ProtectionType/SoftLock.cs
index 3451f142..da864d83 100644
--- a/BurnOutSharp/ProtectionType/SoftLock.cs
+++ b/BurnOutSharp/ProtectionType/SoftLock.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -11,25 +9,26 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("SOFTLOCKI.dat", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SOFTLOCKC.dat", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "SoftLock";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("SOFTLOCKI.dat", useEndsWith: true), "SoftLock"),
+ new PathMatchSet(new PathMatch("SOFTLOCKC.dat", useEndsWith: true), "SoftLock"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("SOFTLOCKI.dat", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SOFTLOCKC.dat", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "SoftLock";
- }
+ new PathMatchSet(new PathMatch("SOFTLOCKI.dat", useEndsWith: true), "SoftLock"),
+ new PathMatchSet(new PathMatch("SOFTLOCKC.dat", useEndsWith: true), "SoftLock"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs
index 64e249bc..ed5d82ce 100644
--- a/BurnOutSharp/ProtectionType/SolidShield.cs
+++ b/BurnOutSharp/ProtectionType/SolidShield.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.IO;
using System.Linq;
using BurnOutSharp.Matching;
@@ -90,29 +89,30 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("dvm.dll", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("hc.dll", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("solidshield-cd.dll", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("c11prot.dll", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "SolidShield";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("dvm.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("hc.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("dvm.dll", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("hc.dll", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("solidshield-cd.dll", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("c11prot.dll", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "SolidShield";
- }
+ new PathMatchSet(new PathMatch("dvm.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("hc.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"),
+ new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
public static string GetExeWrapperVersion(string file, byte[] fileContent, List positions)
diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs
index 4a8e620d..2a933e03 100644
--- a/BurnOutSharp/ProtectionType/StarForce.cs
+++ b/BurnOutSharp/ProtectionType/StarForce.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.Collections.Generic;
using System.Linq;
using BurnOutSharp.Matching;
@@ -125,25 +123,26 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetFileName(f).Equals("protect.dll", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("protect.exe", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "StarForce";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("protect.dll", useEndsWith: true), "StarForce"),
+ new PathMatchSet(new PathMatch("protect.exe", useEndsWith: true), "StarForce"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("protect.dll", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("protect.exe", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "StarForce";
- }
+ new PathMatchSet(new PathMatch("protect.dll", useEndsWith: true), "StarForce"),
+ new PathMatchSet(new PathMatch("protect.exe", useEndsWith: true), "StarForce"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
public static string GetVersion(string file, byte[] fileContent, List positions)
diff --git a/BurnOutSharp/ProtectionType/Steam.cs b/BurnOutSharp/ProtectionType/Steam.cs
index a359d63f..2cca9511 100644
--- a/BurnOutSharp/ProtectionType/Steam.cs
+++ b/BurnOutSharp/ProtectionType/Steam.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,31 +8,32 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("SteamInstall.exe", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SteamInstall.ini", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SteamInstall.msi", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SteamRetailInstaller.dmg", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("SteamSetup.exe", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "Steam";
- }
-
- return null;
+ new PathMatchSet(new PathMatch("SteamInstall.exe", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamInstall.ini", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamInstall.msi", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamRetailInstaller.dmg", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamSetup.exe", useEndsWith: true), "Steam"),
+ };
+
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("SteamInstall.exe", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SteamInstall.ini", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SteamInstall.msi", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SteamRetailInstaller.dmg", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("SteamSetup.exe", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "Steam";
- }
+ new PathMatchSet(new PathMatch("SteamInstall.exe", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamInstall.ini", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamInstall.msi", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamRetailInstaller.dmg", useEndsWith: true), "Steam"),
+ new PathMatchSet(new PathMatch("SteamSetup.exe", useEndsWith: true), "Steam"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/TZCopyProtector.cs b/BurnOutSharp/ProtectionType/TZCopyProtector.cs
index 96eb543e..98b7b659 100644
--- a/BurnOutSharp/ProtectionType/TZCopyProtector.cs
+++ b/BurnOutSharp/ProtectionType/TZCopyProtector.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,19 +8,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("_742893.016", StringComparison.OrdinalIgnoreCase)))
- return "TZCopyProtector";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("_742893.016", useEndsWith: true), "TZCopyProtector"),
+ };
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("_742893.016", StringComparison.OrdinalIgnoreCase))
- return "TZCopyProtector";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("_742893.016", useEndsWith: true), "TZCopyProtector"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs
index d5aa44c8..f5c03a7b 100644
--- a/BurnOutSharp/ProtectionType/Tages.cs
+++ b/BurnOutSharp/ProtectionType/Tages.cs
@@ -6,6 +6,7 @@ using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
+ // TODO: Figure out how to use path check framework here
public class Tages : IContentCheck, IPathCheck
{
///
diff --git a/BurnOutSharp/ProtectionType/Uplay.cs b/BurnOutSharp/ProtectionType/Uplay.cs
index d471034d..c548d48a 100644
--- a/BurnOutSharp/ProtectionType/Uplay.cs
+++ b/BurnOutSharp/ProtectionType/Uplay.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,19 +8,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase)))
- return "Uplay";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay"),
+ };
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase))
- return "Uplay";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
index 76da1a1c..3ccd7f79 100644
--- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
+++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
@@ -38,19 +38,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase)))
- return "VOB ProtectCD/DVD";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("VOB-PCD.KEY", useEndsWith: true), "VOB ProtectCD/DVD"),
+ };
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase))
- return "VOB ProtectCD/DVD";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("VOB-PCD.KEY", useEndsWith: true), "VOB ProtectCD/DVD"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
public static string GetOldVersion(string file, byte[] fileContent, List positions)
diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
index cb0c7132..4e157873 100644
--- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs
+++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
@@ -27,29 +24,30 @@ namespace BurnOutSharp.ProtectionType
public string CheckDirectoryPath(string path, IEnumerable files)
{
// TODO: Verify if these are OR or AND
- if (files.Any(f => Path.GetExtension(f).Trim('.').Equals("IMP", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("imp.dat", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("wtmfiles.dat", StringComparison.OrdinalIgnoreCase))
- || files.Any(f => Path.GetFileName(f).Equals("Viewer.exe", StringComparison.OrdinalIgnoreCase)))
+ var matchers = new List
{
- return "WTM CD Protect";
- }
+ new PathMatchSet(new PathMatch(".IMP", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("imp.dat", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("wtmfiles.dat", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("Viewer.exe", useEndsWith: true), "WTM CD Protect"),
+ };
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetExtension(path).Trim('.').Equals("IMP", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("imp.dat", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("wtmfiles.dat", StringComparison.OrdinalIgnoreCase)
- || Path.GetFileName(path).Equals("Viewer.exe", StringComparison.OrdinalIgnoreCase))
+ var matchers = new List
{
- return "WTM CD Protect";
- }
+ new PathMatchSet(new PathMatch(".IMP", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("imp.dat", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("wtmfiles.dat", useEndsWith: true), "WTM CD Protect"),
+ new PathMatchSet(new PathMatch("Viewer.exe", useEndsWith: true), "WTM CD Protect"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/Winlock.cs b/BurnOutSharp/ProtectionType/Winlock.cs
index b0831d63..c586561d 100644
--- a/BurnOutSharp/ProtectionType/Winlock.cs
+++ b/BurnOutSharp/ProtectionType/Winlock.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,19 +8,24 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (files.Any(f => Path.GetFileName(f).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase)))
- return "Winlock";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("WinLock.PSX", useEndsWith: true), "Winlock"),
+ };
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- if (Path.GetFileName(path).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase))
- return "Winlock";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("WinLock.PSX", useEndsWith: true), "Winlock"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs
index 4ed67989..d75341ee 100644
--- a/BurnOutSharp/ProtectionType/XCP.cs
+++ b/BurnOutSharp/ProtectionType/XCP.cs
@@ -7,6 +7,7 @@ using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
+ // TODO: Figure out how to use path check framework here
public class XCP : IContentCheck, IPathCheck
{
///
diff --git a/BurnOutSharp/ProtectionType/Zzxzz.cs b/BurnOutSharp/ProtectionType/Zzxzz.cs
index 78033a7b..6b4c98d6 100644
--- a/BurnOutSharp/ProtectionType/Zzxzz.cs
+++ b/BurnOutSharp/ProtectionType/Zzxzz.cs
@@ -1,6 +1,6 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -9,23 +9,25 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckDirectoryPath(string path, IEnumerable files)
{
- if (File.Exists(Path.Combine(path, "Zzxzz", "Zzz.aze")))
- return "Zzxzz";
+ var matchers = new List
+ {
+ new PathMatchSet(Path.Combine(path, "Zzxzz", "Zzz.aze"), "Zzxzz"),
+ new PathMatchSet($"Zzxzz{Path.DirectorySeparatorChar}", "Zzxzz"),
+ };
- else if (Directory.Exists(Path.Combine(path, "Zzxzz")))
- return "Zzxzz";
-
- return null;
+ var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
+ return string.Join(", ", matches);
}
///
public string CheckFilePath(string path)
{
- string filename = Path.GetFileName(path);
- if (filename.Equals("Zzz.aze", StringComparison.OrdinalIgnoreCase))
- return "Zzxzz";
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("Zzz.aze", useEndsWith: true), "Zzxzz"),
+ };
- return null;
+ return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}