Advertisement
Guest User

ref

a guest
Feb 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. var files = Directory.GetFiles(folder, "*.dll").Where(x=>Path.GetFileName(x).StartsWith("EDD")).ToList();
  2.            
  3.             foreach (string file in files)
  4.             {
  5.                 try
  6.                 {
  7.  
  8.                     var assembly = Assembly.LoadFrom(file);
  9.                     var types = assembly.GetTypes();
  10.  
  11.                     foreach (Type type in types)
  12.                     {
  13.                         var methods = type.GetMethods();
  14.                         foreach (MethodInfo method in methods)
  15.                         {
  16.                             if (method.GetParameters().Any(x => x.IsOptional))
  17.                             {
  18.                                 Console.WriteLine($"{file}|{type.Name}|{method.Name}");
  19.                             }                            
  20.                         }
  21.                     }
  22.  
  23.                 }
  24.                 catch (ReflectionTypeLoadException ex)
  25.                 {
  26.                     StringBuilder sb = new StringBuilder();
  27.                     foreach (Exception exSub in ex.LoaderExceptions)
  28.                     {
  29.                         sb.AppendLine(exSub.Message);
  30.                         FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
  31.                         if (exFileNotFound != null)
  32.                         {
  33.                             if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
  34.                             {
  35.                                 sb.AppendLine("Fusion Log:");
  36.                                 sb.AppendLine(exFileNotFound.FusionLog);
  37.                             }
  38.                         }
  39.                         sb.AppendLine();
  40.                     }
  41.                     string errorMessage = sb.ToString();
  42.                 }
  43.                 catch (Exception ex)
  44.                 {
  45.                     Console.WriteLine($"ERROR {Path.GetFileName(file)}");
  46.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement