Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/CDLock.cs

52 lines
1.8 KiB
C#
Raw Normal View History

2021-03-22 23:02:01 -07:00
using System.Collections.Generic;
2021-03-21 15:34:19 -07:00
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
2021-02-26 01:26:49 -08:00
public class CDLock : IContentCheck, IPathCheck
{
/// <summary>
/// Set of all ContentMatchSets for this protection
/// </summary>
2021-03-23 16:43:23 -07:00
private static readonly List<ContentMatchSet> contentMatchers = new List<ContentMatchSet>
{
// 2 + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B + $ + (char)0x99 + (char)0xAD + 'C + (char)0xE4 + (char)0x9D + st + (char)0x99 + (char)0xFA + 2$ + (char)0x9D + )4 + (char)0xFF + t
new ContentMatchSet(new byte?[]
2021-03-21 14:30:37 -07:00
{
0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24,
0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74,
0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF,
0x74
}, "CD-Lock"),
};
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
return MatchUtil.GetFirstMatch(file, fileContent, contentMatchers, includePosition);
}
2021-02-26 00:32:09 -08:00
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string> files)
{
2021-03-22 23:02:01 -07:00
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch(".AFP", useEndsWith: true), "CD-Lock"),
};
return MatchUtil.GetAllMatches(files, matchers, any: true);
}
2021-03-19 15:41:49 -07:00
/// <inheritdoc/>
public string CheckFilePath(string path)
{
2021-03-22 23:02:01 -07:00
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch(".AFP", useEndsWith: true), "CD-Lock"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);
2021-03-19 15:41:49 -07:00
}
}
}