@@ -18,7 +18,11 @@ internal static class Handler
18
18
/// <summary>
19
19
/// Cache for all IPathCheck types
20
20
/// </summary>
21
+ #if NET48
21
22
public static IEnumerable < IPathCheck > PathCheckClasses
23
+ #else
24
+ public static IEnumerable < IPathCheck ? > PathCheckClasses
25
+ #endif
22
26
{
23
27
get
24
28
{
@@ -39,7 +43,7 @@ public static IEnumerable<IPathCheck> PathCheckClasses
39
43
#if NET48
40
44
private static IEnumerable < IPathCheck > pathCheckClasses ;
41
45
#else
42
- private static IEnumerable < IPathCheck > ? pathCheckClasses ;
46
+ private static IEnumerable < IPathCheck ? > ? pathCheckClasses ;
43
47
#endif
44
48
45
49
#endregion
@@ -67,7 +71,7 @@ public static ConcurrentDictionary<string, ConcurrentQueue<string>> HandlePathCh
67
71
// Iterate through all checks
68
72
Parallel . ForEach ( PathCheckClasses , checkClass =>
69
73
{
70
- var subProtections = checkClass . PerformCheck ( path , files ) ;
74
+ var subProtections = checkClass ? . PerformCheck ( path , files ) ;
71
75
if ( subProtections != null )
72
76
AppendToDictionary ( protections , path , subProtections ) ;
73
77
} ) ;
@@ -162,7 +166,7 @@ private static ConcurrentQueue<string> PerformCheck(this IPathCheck impl, string
162
166
return null ;
163
167
164
168
// Setup the output dictionary
165
- var protections = new ConcurrentQueue < string > ( ) ;
169
+ var protections = new ConcurrentQueue < string > ( ) ;
166
170
167
171
// If we have a file path
168
172
if ( File . Exists ( path ) )
@@ -191,18 +195,33 @@ private static ConcurrentQueue<string> PerformCheck(this IPathCheck impl, string
191
195
/// <summary>
192
196
/// Initialize all implementations of a type
193
197
/// </summary>
198
+ #if NET48
194
199
private static IEnumerable < T > InitCheckClasses < T > ( )
195
- => InitCheckClasses < T > ( typeof ( BinaryObjectScanner . Packer . _DUMMY ) . Assembly )
196
- . Concat ( InitCheckClasses < T > ( typeof ( BinaryObjectScanner . Protection . _DUMMY ) . Assembly ) ) ;
200
+ #else
201
+ private static IEnumerable < T ? > InitCheckClasses < T > ( )
202
+ #endif
203
+ {
204
+ return InitCheckClasses < T > ( typeof ( GameEngine . _DUMMY ) . Assembly )
205
+ . Concat ( InitCheckClasses < T > ( typeof ( Packer . _DUMMY ) . Assembly ) )
206
+ . Concat ( InitCheckClasses < T > ( typeof ( Protection . _DUMMY ) . Assembly ) ) ;
207
+ }
197
208
198
209
/// <summary>
199
210
/// Initialize all implementations of a type
200
211
/// </summary>
212
+ #if NET48
201
213
private static IEnumerable < T > InitCheckClasses < T > ( Assembly assembly )
214
+ #else
215
+ private static IEnumerable < T ? > InitCheckClasses < T > ( Assembly assembly )
216
+ #endif
202
217
{
203
218
return assembly . GetTypes ( ) ?
204
219
. Where ( t => t . IsClass && t . GetInterface ( typeof ( T ) . Name ) != null ) ?
220
+ #if NET48
205
221
. Select ( t => ( T ) Activator . CreateInstance ( t ) ) ?? Array . Empty < T > ( ) ;
222
+ #else
223
+ . Select ( t => ( T ? ) Activator . CreateInstance ( t ) ) ?? Array . Empty < T > ( ) ;
224
+ #endif
206
225
}
207
226
208
227
#endregion
0 commit comments