Skip to content

Commit 8b8c373

Browse files
updated readme.md for release 1.1.0 (#2)
1 parent 132d5d5 commit 8b8c373

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff 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
```
5072
This will be expanded in the future so more checks will be added.

0 commit comments

Comments
 (0)