2019-09-27 23:52:24 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.ProtectionType
|
|
|
|
|
|
{
|
|
|
|
|
|
public class SmartE
|
|
|
|
|
|
{
|
2020-09-10 21:43:18 -07:00
|
|
|
|
public static string CheckContents(byte[] fileContent, bool includePosition = false)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2020-10-28 10:42:54 -07:00
|
|
|
|
// BITARTS
|
2020-09-10 21:10:32 -07:00
|
|
|
|
byte[] check = new byte[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 };
|
|
|
|
|
|
if (fileContent.Contains(check, out int position))
|
2020-09-10 21:43:18 -07:00
|
|
|
|
return "SmartE" + (includePosition ? $" (Index {position})" : string.Empty);
|
2019-09-27 23:52:24 -07:00
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string CheckPath(string path, IEnumerable<string> files, bool isDirectory)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isDirectory)
|
|
|
|
|
|
{
|
|
|
|
|
|
// TODO: Verify if these are OR or AND
|
2020-02-20 14:23:39 -08:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
|
return "SmartE";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Path.GetFileName(path).Equals("00001.TMP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|
|| Path.GetFileName(path).Equals("00002.TMP", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
{
|
|
|
|
|
|
return "SmartE";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|