From 6a71a7c4e922d6fb37b8a33a4aba9f0e363d6ca9 Mon Sep 17 00:00:00 2001 From: Suchakra Sharma Date: Thu, 22 Feb 2024 13:06:05 -0500 Subject: [PATCH] fix param list and add public method filter --- DotNetAstGen/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DotNetAstGen/Program.cs b/DotNetAstGen/Program.cs index b888d1c..3983221 100644 --- a/DotNetAstGen/Program.cs +++ b/DotNetAstGen/Program.cs @@ -192,20 +192,20 @@ static void ProcessDll(string dllPath, string jsonPath) { var classInfo = new ClassInfo(); var methodInfoList = new List(); - var parameterTypesList = new List(); + var parameterTypesList = new List>(); 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;