Exemplo n.º 1
0
        private bool IsPublicField(MemberReference reference)
        {
            var parentType = _reflector.ResolveTypeReference(reference.DeclaringType);

            return((CecilReflector.GetField(parentType, reference.Name).Attributes & FieldAttributes.Public) ==
                   FieldAttributes.Public);
        }
Exemplo n.º 2
0
        private static bool IsTransient(TypeDefinition type, MemberReference fieldRef)
        {
            FieldDefinition field = CecilReflector.GetField(type, fieldRef.Name);

            if (field == null)
            {
                return(true);
            }
            return(field.IsNotSerialized);
        }
Exemplo n.º 3
0
        private static MethodDefinition Resolve(MethodReference methodRef)
        {
            var methodDefinition = methodRef as MethodDefinition;

            if (methodDefinition != null)
            {
                return(methodDefinition);
            }

            var assemblyDefinition = AssemblyDefinition.ReadAssembly(methodRef.DeclaringType.Module.FullyQualifiedName);
            var type = assemblyDefinition.MainModule.GetType(methodRef.DeclaringType.Name);

            return(CecilReflector.GetMethod(type, methodRef));
        }
Exemplo n.º 4
0
        public static MethodDefinition FindMethod(AssemblyDefinition assembly, string typeName, string methodName)
        {
            var testType = assembly.MainModule.GetType(typeName);

            return(CecilReflector.GetMethod(testType, methodName));
        }
Exemplo n.º 5
0
 private static MethodDefinition GetMatchMethod(TypeDefinition type)
 {
     return(CecilReflector.GetMethod(type, "Match"));
 }
Exemplo n.º 6
0
 private static MethodDefinition GetMethodDefinition(AssemblyDefinition assembly, string typeName, string methodName)
 {
     return(CecilReflector.GetMethod(assembly.MainModule.GetType(typeName), methodName));
 }
Exemplo n.º 7
0
        internal static MethodReference ConstructorFor(TypeReference type, params Type[] parameterTypes)
        {
            TypeDefinition definition = type.Resolve();

            return(CecilReflector.GetMethod(definition, ".ctor", parameterTypes.Select(p => p.IsGenericType ? p.GetGenericTypeDefinition() : p).ToArray()));
        }
 private static MethodDefinition InstrumentedMethod(AssemblyDefinition testAssembly)
 {
     return(CecilReflector.GetMethod(testAssembly.MainModule.GetType("InstrumentedType"), "InstrumentedMethod"));
 }
Exemplo n.º 9
0
 protected override void BeforeAssemblyProcessing()
 {
     _reflector = new CecilReflector(_context);
     _collectionsStep.Context = _context;
     CreateTagAttribute();
 }
Exemplo n.º 10
0
 public DelegateQueryProcessor(InstrumentationContext context, DelegateOptimizer optimizer)
 {
     _context   = context;
     _optimizer = optimizer;
     _reflector = new CecilReflector(_context);
 }
Exemplo n.º 11
0
        internal static MethodReference ContructorFor(TypeReference type, params Type[] parameterTypes)
        {
            TypeDefinition definition = type.Resolve();

            return(CecilReflector.GetMethod(definition, ".ctor", parameterTypes));
        }