Final batch of first pass for path check conversions

This commit is contained in:
Matt Nadareski
2021-03-23 10:36:14 -07:00
parent 7d13b8c9db
commit aa83896963
19 changed files with 231 additions and 218 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
// TODO: Figure out how to use path check framework here
public class ProtectDVDVideo : IPathCheck
{
/// <inheritdoc/>

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase)))
return "SafeCast";
return null;
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("cdac11ba.exe", useEndsWith: true), "SafeCast"),
};
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("cdac11ba.exe", StringComparison.OrdinalIgnoreCase))
return "SafeCast";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("cdac11ba.exe", useEndsWith: true), "SafeCast"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -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
{
/// <summary>

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase)))
return "SafeDisc Lite";
return null;
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("00000001.LT1", useEndsWith: true), "SafeDisc Lite"),
};
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("00000001.LT1", StringComparison.OrdinalIgnoreCase))
return "SafeDisc Lite";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("00000001.LT1", useEndsWith: true), "SafeDisc Lite"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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);
}
}
}

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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<int> positions)

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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);
}
}
}

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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);
}
}
}

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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<int> positions)

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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<int> positions)

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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);
}
}
}

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("_742893.016", StringComparison.OrdinalIgnoreCase)))
return "TZCopyProtector";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("_742893.016", useEndsWith: true), "TZCopyProtector"),
};
return null;
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("_742893.016", StringComparison.OrdinalIgnoreCase))
return "TZCopyProtector";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("_742893.016", useEndsWith: true), "TZCopyProtector"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -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
{
/// <summary>

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase)))
return "Uplay";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay"),
};
return null;
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("UplayInstaller.exe", StringComparison.OrdinalIgnoreCase))
return "Uplay";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -38,19 +38,24 @@ namespace BurnOutSharp.ProtectionType
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase)))
return "VOB ProtectCD/DVD";
var matchers = new List<PathMatchSet>
{
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);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("VOB-PCD.KEY", StringComparison.OrdinalIgnoreCase))
return "VOB ProtectCD/DVD";
var matchers = new List<PathMatchSet>
{
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<int> positions)

View File

@@ -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<string> 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<PathMatchSet>
{
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);
}
/// <inheritdoc/>
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<PathMatchSet>
{
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);
}
}
}

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (files.Any(f => Path.GetFileName(f).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase)))
return "Winlock";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("WinLock.PSX", useEndsWith: true), "Winlock"),
};
return null;
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("WinLock.PSX", StringComparison.OrdinalIgnoreCase))
return "Winlock";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("WinLock.PSX", useEndsWith: true), "Winlock"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -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
{
/// <summary>

View File

@@ -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
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
if (File.Exists(Path.Combine(path, "Zzxzz", "Zzz.aze")))
return "Zzxzz";
var matchers = new List<PathMatchSet>
{
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);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
string filename = Path.GetFileName(path);
if (filename.Equals("Zzz.aze", StringComparison.OrdinalIgnoreCase))
return "Zzxzz";
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("Zzz.aze", useEndsWith: true), "Zzxzz"),
};
return null;
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}