Skip to content

Commit

Permalink
fix param list and add public method filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxology committed Feb 22, 2024
1 parent a4f78c5 commit 6a71a7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions DotNetAstGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,20 @@ static void ProcessDll(string dllPath, string jsonPath)
{
var classInfo = new ClassInfo();
var methodInfoList = new List<MethodInfo>();
var parameterTypesList = new List<string>();
var parameterTypesList = new List<List<string>>();

Regex filter = new Regex("^.*(\\.(ctor|cctor))", RegexOptions.IgnoreCase);

foreach (var method in typ.Methods.Where(m => !filter.IsMatch(m.Name)))
foreach (var method in typ.Methods.Where(m => !filter.IsMatch(m.Name)).Where( m => m.IsPublic))
{
var methodInfo = new MethodInfo();
methodInfo.name = method.Name.Split("`")[0];
methodInfo.returnType = method.ReturnType.ToString();
methodInfo.isStatic = true;
methodInfo.isStatic = method.IsStatic;
foreach (var param in method.Parameters)
{
parameterTypesList.Add(param.ParameterType.ToString());
methodInfo.parameterTypes = [parameterTypesList.Distinct().ToList()];
parameterTypesList.Add([param.Name.ToString(), param.ParameterType.ToString()]);
methodInfo.parameterTypes = parameterTypesList;
}
methodInfoList.Add(methodInfo);
classInfo.methods = methodInfoList;
Expand Down

0 comments on commit 6a71a7c

Please sign in to comment.