Skip to content

Commit

Permalink
add more filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxology committed Feb 22, 2024
1 parent 155133f commit 2cc999f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions DotNetAstGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,15 @@ static void ProcessDll(string dllPath, string jsonPath)
var classInfoList = new List<ClassInfo>();

using var x = AssemblyDefinition.ReadAssembly(dllPath, p);
Regex typeFilter = new Regex("^(<PrivateImplementationDetails>|<Module>|.*AnonymousType).*", RegexOptions.IgnoreCase);
Regex methodFilter = new Regex("^.*\\.(ctor|cctor)", RegexOptions.IgnoreCase);

foreach (var typ in x.MainModule.GetAllTypes().DistinctBy(t => t.FullName).Where(t => t.Name != null))
foreach (var typ in x.MainModule.GetAllTypes().DistinctBy(t => t.FullName).Where(t => t.Name != null).Where(t => !typeFilter.IsMatch(t.FullName)))
{
var classInfo = new ClassInfo();
var methodInfoList = new List<MethodInfo>();
Regex filter = new Regex("^.*(\\.(ctor|cctor))", RegexOptions.IgnoreCase);

foreach (var method in typ.Methods.Where(m => !filter.IsMatch(m.Name)).Where( m => m.IsPublic))
foreach (var method in typ.Methods.Where(m => !methodFilter.IsMatch(m.Name)).Where( m => m.IsPublic))
{
var methodInfo = new MethodInfo();
var parameterTypesList = new List<List<string>>();
Expand Down

0 comments on commit 2cc999f

Please sign in to comment.