File tree Expand file tree Collapse file tree 1 file changed +26
-4
lines changed
Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,33 @@ If there is any errors, the program will ask you if you want to open the log fil
4040[ Here] ( https://github.com/mauricepreiss/CSharpFinder/blob/master/CSharpFinder/Program.cs#L523 )
4141 is one of the many function how the program identifies a file as a c# / .net assembly:
4242``` C#
43- private static bool IsCSharpAssembly (Assembly assembly )
43+ private static bool IsGeneratedOrSystemAssembly (Assembly assembly )
4444{
45- return assembly .GetCustomAttributes (typeof (CompilerGeneratedAttribute ), inherit : false ).Any () ||
46- assembly .GetTypes ().Any (type => type .GetCustomAttributes (typeof (CompilerGeneratedAttribute ), inherit : false ).Any () ||
47- type .FullName ? .StartsWith (" System" , StringComparison .Ordinal ) == false );
45+ try
46+ {
47+ var types = assembly .GetTypes ();
48+
49+ if (types .Any (type => type .FullName ? .StartsWith (" System" , StringComparison .Ordinal ) == false ))
50+ {
51+ return true ;
52+ }
53+
54+ if (assembly .GetTypes ().Any (type => type .GetCustomAttributes (typeof (CompilerGeneratedAttribute ), inherit : false ).Any ()))
55+ {
56+ return true ;
57+ }
58+
59+ if (assembly .GetCustomAttributes (typeof (CompilerGeneratedAttribute ), inherit : false ).Any ())
60+ {
61+ return true ;
62+ }
63+
64+ return false ;
65+ }
66+ catch
67+ {
68+ return false ;
69+ }
4870}
4971```
5072This will be expanded in the future so more checks will be added.
You can’t perform that action at this time.
0 commit comments