mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-23 15:24:45 +00:00
Add better detection for XCP2
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BurnOutSharp.FileType;
|
||||
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
@@ -11,9 +12,14 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
if (isDirectory)
|
||||
{
|
||||
// INI-like file that can be parsed out
|
||||
string xcpDatPath = files.FirstOrDefault(f => Path.GetFileName(f).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase))
|
||||
?? files.FirstOrDefault(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase));
|
||||
if (!string.IsNullOrWhiteSpace(xcpDatPath))
|
||||
return GetXCPVersion(xcpDatPath);
|
||||
|
||||
// TODO: Verify if these are OR or AND
|
||||
if (files.Any(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase))
|
||||
|| files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase))
|
||||
if (files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase))
|
||||
|| files.Any(f => Path.GetFileName(f).Equals("go.exe", StringComparison.OrdinalIgnoreCase))) // Path.Combine("contents", "go.exe")
|
||||
{
|
||||
return "XCP";
|
||||
@@ -21,8 +27,14 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Path.GetFileName(path).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase)
|
||||
|| Path.GetFileName(path).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)
|
||||
// INI-like file that can be parsed out
|
||||
if (Path.GetFileName(path).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase)
|
||||
|| Path.GetFileName(path).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetXCPVersion(path);
|
||||
}
|
||||
|
||||
if (Path.GetFileName(path).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)
|
||||
|| Path.GetFileName(path).Equals("go.exe", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "XCP";
|
||||
@@ -31,5 +43,18 @@ namespace BurnOutSharp.ProtectionType
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string GetXCPVersion(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var xcpIni = new IniFile(path);
|
||||
return xcpIni["XCP.VERSION"];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user