2019-09-27 23:52:24 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2021-03-21 15:34:19 -07:00
|
|
|
|
using BurnOutSharp.Matching;
|
2019-09-27 23:52:24 -07:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.ProtectionType
|
|
|
|
|
|
{
|
2021-02-26 01:26:49 -08:00
|
|
|
|
public class SmartE : IContentCheck, IPathCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-02-26 01:26:49 -08:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-21 15:34:19 -07:00
|
|
|
|
var matchers = new List<Matcher>
|
2021-03-21 14:30:37 -07:00
|
|
|
|
{
|
|
|
|
|
|
// BITARTS
|
2021-03-21 15:34:19 -07:00
|
|
|
|
new Matcher(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"),
|
2021-03-21 14:30:37 -07:00
|
|
|
|
};
|
2019-09-27 23:52:24 -07:00
|
|
|
|
|
2021-03-21 22:37:16 -07:00
|
|
|
|
return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-26 00:32:09 -08:00
|
|
|
|
/// <inheritdoc/>
|
2021-03-19 15:41:49 -07:00
|
|
|
|
public string CheckDirectoryPath(string path, IEnumerable<string> files)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-19 15:41:49 -07:00
|
|
|
|
// 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)))
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-19 15:41:49 -07:00
|
|
|
|
return "SmartE";
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
2021-03-19 15:41:49 -07:00
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string CheckFilePath(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Path.GetFileName(path).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|
|| Path.GetFileName(path).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase))
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-19 15:41:49 -07:00
|
|
|
|
return "SmartE";
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|