mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-15 05:36:03 +00:00
Add new helpers for NE/PE specific
This commit is contained in:
@@ -19,6 +19,16 @@ namespace BurnOutSharp.FileType
|
||||
/// </summary>
|
||||
private static readonly IEnumerable<IContentCheck> contentCheckClasses = InitContentCheckClasses();
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all INEContentCheck types
|
||||
/// </summary>
|
||||
private static readonly IEnumerable<INEContentCheck> neContentCheckClasses = InitNEContentCheckClasses();
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all IPEContentCheck types
|
||||
/// </summary>
|
||||
private static readonly IEnumerable<IPEContentCheck> peContentCheckClasses = InitPEContentCheckClasses();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool ShouldScan(byte[] magic)
|
||||
{
|
||||
@@ -139,6 +149,26 @@ namespace BurnOutSharp.FileType
|
||||
.Where(t => t.IsClass && t.GetInterface(nameof(IContentCheck)) != null)
|
||||
.Select(t => Activator.CreateInstance(t) as IContentCheck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize all INEContentCheck implementations
|
||||
/// </summary>
|
||||
private static IEnumerable<INEContentCheck> InitNEContentCheckClasses()
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetTypes()
|
||||
.Where(t => t.IsClass && t.GetInterface(nameof(INEContentCheck)) != null)
|
||||
.Select(t => Activator.CreateInstance(t) as INEContentCheck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize all IPEContentCheck implementations
|
||||
/// </summary>
|
||||
private static IEnumerable<IPEContentCheck> InitPEContentCheckClasses()
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetTypes()
|
||||
.Where(t => t.IsClass && t.GetInterface(nameof(IPEContentCheck)) != null)
|
||||
.Select(t => Activator.CreateInstance(t) as IPEContentCheck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a protection should be added or not
|
||||
|
||||
Reference in New Issue
Block a user