public IEnumerable <MethodBase> GetMethods() { Dictionary <string, Type> types = _assembly.GetTypes().ToDictionary(t => t.FullName); foreach (var methodItem in _methodList.Methods) { if (!types.TryGetValue(methodItem.FullTypeName, out Type type)) { continue; } var candidates = EtwSignatureMapper.GetMethodCandidates(type, methodItem.MethodName); if (candidates.Length == 0) { Console.WriteLine($"Method {type.FullName}.{methodItem.MethodName} could not be found."); continue; } var method = SelectOverload(candidates, methodItem.Signature); if (method == null) { Console.WriteLine($"Method {type.FullName}.{methodItem.MethodName}({methodItem.Signature}) could not be found."); continue; } if (UnorderedMethodProvider.IsIgnored(method)) { continue; } yield return(method); } }
public IEnumerable <MethodBase> GetMethods() { var match = Regex.Match(_methodSpecifier, @"(.+)\|(.+?)\((.*?)\)"); if (!match.Success) { throw new ArgumentOutOfRangeException("Invalid methodSpecifier"); } string typeName = match.Groups[1].Value; string methodName = match.Groups[2].Value; string[] parameters = match.Groups[3].Value.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries); var type = _assembly.GetType(typeName); var candidates = EtwSignatureMapper.GetMethodCandidates(type, methodName); if (candidates.Length == 1) { yield return(candidates[0]); } else { yield return(SelectOverload(candidates, parameters)); } }
private static MethodBase SelectOverload(MethodBase[] methods, string signature) { return(EtwSignatureMapper.SelectOverload(methods, signature)); }