Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/MediaMaxCD3.cs

45 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace BurnOutSharp.ProtectionType
{
2021-02-26 01:26:49 -08:00
public class MediaMaxCD3 : IContentCheck, IPathCheck
{
2021-02-26 01:26:49 -08:00
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
2020-11-03 14:41:05 -08:00
{
// Cd3Ctl
2021-03-20 20:47:56 -07:00
byte?[] check = new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C };
2021-03-20 19:00:22 -07:00
if (fileContent.FirstPosition(check, out int position))
2020-11-03 14:41:05 -08:00
return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty);
// DllInstallSbcp
2021-03-20 20:47:56 -07:00
check = new byte?[] { 0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 };
2021-03-20 19:00:22 -07:00
if (fileContent.FirstPosition(check, out position))
2020-11-03 14:41:05 -08:00
return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}
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)
{
2021-03-19 15:41:49 -07:00
if (files.Any(f => Path.GetFileName(f).Equals("LaunchCd.exe", StringComparison.OrdinalIgnoreCase)))
return "MediaMax CD-3";
return null;
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
if (Path.GetFileName(path).Equals("LaunchCd.exe", StringComparison.OrdinalIgnoreCase))
return "MediaMax CD-3";
return null;
}
}
}