From 863678f85047701b22a1000e6bfc0aa145263d31 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 13 Mar 2023 21:05:18 -0400 Subject: [PATCH] Add extractable protections to caches --- BurnOutSharp/ScanningClasses.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/BurnOutSharp/ScanningClasses.cs b/BurnOutSharp/ScanningClasses.cs index 7f848457..7c689e69 100644 --- a/BurnOutSharp/ScanningClasses.cs +++ b/BurnOutSharp/ScanningClasses.cs @@ -27,6 +27,20 @@ namespace BurnOutSharp } } + /// + /// Cache for all IExtractable types + /// + public static IEnumerable ExtractableClasses + { + get + { + if (extractableClasses == null) + extractableClasses = InitCheckClasses(); + + return extractableClasses; + } + } + /// /// Cache for all ILinearExecutableCheck types /// @@ -92,6 +106,11 @@ namespace BurnOutSharp /// private static IEnumerable contentCheckClasses; + /// + /// Cache for all IExtractable types + /// + private static IEnumerable extractableClasses; + /// /// Cache for all ILinearExecutableCheck types /// @@ -120,8 +139,7 @@ namespace BurnOutSharp /// Initialize all implementations of a type /// private static IEnumerable InitCheckClasses() - => InitCheckClasses(Assembly.GetExecutingAssembly()) - .Concat(InitCheckClasses(typeof(BinaryObjectScanner.Packer._DUMMY).Assembly)) + => InitCheckClasses(typeof(BinaryObjectScanner.Packer._DUMMY).Assembly) .Concat(InitCheckClasses(typeof(BinaryObjectScanner.Protection._DUMMY).Assembly)); ///