コード例 #1
0
 public void Accept(CodeVisitor visitor)
 {
     FileInfo[] allDlls = new DirectoryInfo(cleanCopyOfDllsLocation).GetFiles("*.dll", SearchOption.AllDirectories);
     List<FileInfo> files = allDlls.ToList().FindAll(MatchesPattern).ToList();
     var assemblies =
         new List<AssemblyDefinition>(files.Select(file => AssemblyFactory.GetAssembly(Path.Combine(cleanCopyOfDllsLocation, file.Name))));
     foreach (AssemblyDefinition assembly in assemblies)
     {
         ProcessAssembly(visitor, assembly);
     }
 }
コード例 #2
0
 public void ProcessAssembly(CodeVisitor visitor, AssemblyDefinition assembly)
 {
     visitor.StartVisitingAssemblyDefinition(assembly);
     //            new StrongName(assembly, assemblyInstrumentationCondition).FixReferences();
     TypeDefinitionCollection types = assembly.MainModule.Types;
     foreach (TypeDefinition type in types)
     {
         if(typeInstrumentCondition.Matches(type.Name))
             ProcessType(type, visitor);
     }
     visitor.FinishVisitingAssemblyDefinition(assembly);
 }
コード例 #3
0
 private static void ProcessType(TypeDefinition type, CodeVisitor visitor)
 {
     visitor.StartVisitingTypeDefinition(type);
     foreach (FieldDefinition field in type.Fields)
     {
         visitor.VisitFieldDefinition(field);
     }
     foreach (MethodDefinition method in type.Methods)
     {
         visitor.VisitMethodDefinition(method);
     }
     foreach (MethodDefinition constructor in type.Constructors)
     {
         visitor.VisitMethodDefinition(constructor);
     }
     visitor.FinishVisitingTypeDefinition(type);
 }