mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-22 06:45:03 +00:00
Path protections separator-agnostic (fixes #47)
This commit is contained in:
@@ -12,10 +12,10 @@ namespace BurnOutSharp.ProtectionType
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
// BD-ROM
|
||||
new PathMatchSet(Path.Combine("AACS", "MKB_RO.inf"), GetVersion, "AACS"),
|
||||
new PathMatchSet(Path.Combine("AACS", "MKB_RO.inf").Replace("\\", "/"), GetVersion, "AACS"),
|
||||
|
||||
// HD-DVD
|
||||
new PathMatchSet(Path.Combine("AACS", "MKBROM.AACS"), GetVersion, "AACS"),
|
||||
new PathMatchSet(Path.Combine("AACS", "MKBROM.AACS").Replace("\\", "/"), GetVersion, "AACS"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
new PathMatchSet(new List<string>
|
||||
{
|
||||
Path.Combine("BDSVM", "00000.svm"),
|
||||
Path.Combine("BDSVM", "BACKUP", "00000.svm"),
|
||||
Path.Combine("BDSVM", "00000.svm").Replace("\\", "/"),
|
||||
Path.Combine("BDSVM", "BACKUP", "00000.svm").Replace("\\", "/"),
|
||||
}, GetVersion, "BD+"),
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
for (int i = 0; i < bupfiles.Length; i++)
|
||||
{
|
||||
FileInfo bupfile = new FileInfo(bupfiles[i]);
|
||||
FileInfo ifofile = new FileInfo(bupfile.DirectoryName + "\\" + bupfile.Name.Substring(0, bupfile.Name.Length - bupfile.Extension.Length) + ".ifo");
|
||||
FileInfo ifofile = new FileInfo(Path.Combine(bupfile.DirectoryName, bupfile.Name.Substring(0, bupfile.Name.Length - bupfile.Extension.Length) + ".ifo"));
|
||||
if (bupfile.Length != ifofile.Length)
|
||||
return new List<string>() { "DVD-Movie-PROTECT" };
|
||||
}
|
||||
|
||||
@@ -139,8 +139,6 @@ namespace BurnOutSharp.ProtectionType
|
||||
// TODO: Re-consolidate these once path matching is improved
|
||||
new PathMatchSet(new PathMatch("/protect.dll", useEndsWith: true), "StarForce"),
|
||||
new PathMatchSet(new PathMatch("/protect.exe", useEndsWith: true), "StarForce"),
|
||||
new PathMatchSet(new PathMatch("\\protect.dll", useEndsWith: true), "StarForce"),
|
||||
new PathMatchSet(new PathMatch("\\protect.exe", useEndsWith: true), "StarForce"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
new PathMatchSet(Path.Combine("ZDAT", "webmast.dxx"), "Tivola Ring Protection [Check disc for physical ring]"),
|
||||
new PathMatchSet(Path.Combine("ZDAT", "webmast.dxx").Replace("\\", "/"), "Tivola Ring Protection [Check disc for physical ring]"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
||||
@@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
new PathMatchSet(Path.Combine("ZDAT", "webmast.dxx"), "Tivola Ring Protection [Check disc for physical ring]"),
|
||||
new PathMatchSet(Path.Combine("ZDAT", "webmast.dxx").Replace("\\", "/"), "Tivola Ring Protection [Check disc for physical ring]"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BurnOutSharp.Matching;
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
new PathMatchSet(Path.Combine(path, "Zzxzz", "Zzz.aze"), "Zzxzz"),
|
||||
new PathMatchSet($"Zzxzz{Path.DirectorySeparatorChar}", "Zzxzz"),
|
||||
new PathMatchSet(Path.Combine(path, "Zzxzz", "Zzz.aze").Replace("\\", "/"), "Zzxzz"),
|
||||
new PathMatchSet($"Zzxzz/", "Zzxzz"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
||||
|
||||
@@ -187,6 +187,9 @@ namespace BurnOutSharp
|
||||
// Create an empty list for protections
|
||||
List<string> protections = new List<string>();
|
||||
|
||||
// Preprocess the list of files
|
||||
files = files.Select(f => f.Replace('\\', '/')).ToList();
|
||||
|
||||
// Iterate through all path checks
|
||||
foreach (var pathCheckClass in pathCheckClasses)
|
||||
{
|
||||
@@ -215,7 +218,7 @@ namespace BurnOutSharp
|
||||
// Iterate through all path checks
|
||||
foreach (var pathCheckClass in pathCheckClasses)
|
||||
{
|
||||
string protection = pathCheckClass.CheckFilePath(path);
|
||||
string protection = pathCheckClass.CheckFilePath(path.Replace("\\", "/"));
|
||||
if (!string.IsNullOrWhiteSpace(protection))
|
||||
protections.Add(protection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user