Skip to content

Commit

Permalink
updated readme.md for release 1.1.0 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricepreiss authored Dec 11, 2023
1 parent 132d5d5 commit 8b8c373
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,33 @@ If there is any errors, the program will ask you if you want to open the log fil
[Here](https://github.com/mauricepreiss/CSharpFinder/blob/master/CSharpFinder/Program.cs#L523)
is one of the many function how the program identifies a file as a c# / .net assembly:
```C#
private static bool IsCSharpAssembly(Assembly assembly)
private static bool IsGeneratedOrSystemAssembly(Assembly assembly)
{
return assembly.GetCustomAttributes(typeof(CompilerGeneratedAttribute), inherit: false).Any() ||
assembly.GetTypes().Any(type => type.GetCustomAttributes(typeof(CompilerGeneratedAttribute), inherit: false).Any() ||
type.FullName?.StartsWith("System", StringComparison.Ordinal) == false);
try
{
var types = assembly.GetTypes();

if (types.Any(type => type.FullName?.StartsWith("System", StringComparison.Ordinal) == false))
{
return true;
}

if (assembly.GetTypes().Any(type => type.GetCustomAttributes(typeof(CompilerGeneratedAttribute), inherit: false).Any()))
{
return true;
}

if (assembly.GetCustomAttributes(typeof(CompilerGeneratedAttribute), inherit: false).Any())
{
return true;
}

return false;
}
catch
{
return false;
}
}
```
This will be expanded in the future so more checks will be added.
Expand Down

0 comments on commit 8b8c373

Please sign in to comment.