Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/CopyKiller.cs
Matt Nadareski 921292e077 Static list of content matchers
This also includes some more path matcher conversions that I couldn't reasonably split out
2021-03-23 09:52:09 -07:00

53 lines
1.8 KiB
C#

using System.Collections.Generic;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
public class CopyKiller : IContentCheck, IPathCheck
{
/// <summary>
/// Set of all ContentMatchSets for this protection
/// </summary>
private static List<ContentMatchSet> contentMatchers = new List<ContentMatchSet>
{
// Tom Commander
new ContentMatchSet(new byte?[]
{
0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
0x61, 0x6E, 0x64, 0x65, 0x72
}, "CopyKiller"),
};
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
return MatchUtil.GetFirstMatch(file, fileContent, contentMatchers, includePosition);
}
/// <inheritdoc/>
public string CheckDirectoryPath(string path, IEnumerable<string> files)
{
// TODO: The following checks are overly broad and should be refined
var matchers = new List<PathMatchSet>
{
//new PathMatchSet(new PathMatch("Autorun.dat", useEndsWith: true), "CopyKiller"),
};
var matches = MatchUtil.GetAllMatches(files, matchers, any: true);
return string.Join(", ", matches);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
// TODO: The following checks are overly broad and should be refined
var matchers = new List<PathMatchSet>
{
//new PathMatchSet(new PathMatch("Autorun.dat", useEndsWith: true), "CopyKiller"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}