diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 3e47c479..f1001684 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -19,6 +19,16 @@ namespace BurnOutSharp.FileType /// private static readonly IEnumerable contentCheckClasses = InitContentCheckClasses(); + /// + /// Cache for all INEContentCheck types + /// + private static readonly IEnumerable neContentCheckClasses = InitNEContentCheckClasses(); + + /// + /// Cache for all IPEContentCheck types + /// + private static readonly IEnumerable peContentCheckClasses = InitPEContentCheckClasses(); + /// 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); } + + /// + /// Initialize all INEContentCheck implementations + /// + private static IEnumerable InitNEContentCheckClasses() + { + return Assembly.GetExecutingAssembly().GetTypes() + .Where(t => t.IsClass && t.GetInterface(nameof(INEContentCheck)) != null) + .Select(t => Activator.CreateInstance(t) as INEContentCheck); + } + + /// + /// Initialize all IPEContentCheck implementations + /// + private static IEnumerable InitPEContentCheckClasses() + { + return Assembly.GetExecutingAssembly().GetTypes() + .Where(t => t.IsClass && t.GetInterface(nameof(IPEContentCheck)) != null) + .Select(t => Activator.CreateInstance(t) as IPEContentCheck); + } /// /// Check to see if a protection should be added or not