Exemple #1
0
    public void Execute()
    {
        var storableTypeFinder = new TypeFinder(ModuleDefinition, AssemblyResolver, ISTORABLE);

        storableTypeFinder.Execute();

        var checkLoadedInjector = new MethodFinder(ModuleDefinition, CHECK_IS_LOADED, 0);

        var typeResolver = new TypeResolver();
        var implementsInterfaceFinder = new ImplementsInterfaceFinder(typeResolver);

        var classes = ModuleDefinition.GetTypes()
                      .Where(x => x.IsClass)
                      .ToList();

        foreach (var type in classes)
        {
            var baseType = implementsInterfaceFinder.HierarchyImplementsIStorable(type);
            if (baseType == null)
            {
                continue;
            }
            var checkMethod = checkLoadedInjector.Execute(baseType);
            ProcessType(type, checkMethod);
        }
    }
Exemple #2
0
    public override void Execute()
    {
        var freezableTypeFinder = new FreezableTypeFinder(ModuleDefinition, ResolveAssembly);

        freezableTypeFinder.Execute();
        var typeFinder = new TypeFinder(ModuleDefinition, FindType);

        typeFinder.Execute();

        var volatileFieldFixer    = new VolatileFieldFixer(typeFinder);
        var fieldInjector         = new FieldInjector(typeFinder, ModuleDefinition.TypeSystem, volatileFieldFixer);
        var checkIsFrozenBuilder  = new CheckIsFrozenBuilder(ModuleDefinition.TypeSystem, typeFinder);
        var freezeCheckerInjector = new FreezeCheckerInjector(ModuleDefinition, fieldInjector, checkIsFrozenBuilder);

        var typeResolver = new TypeResolver();
        var implementsInterfaceFinder = new ImplementsInterfaceFinder(typeResolver);

        var classes = ModuleDefinition.GetTypes()
                      .Where(x => x.IsClass)
                      .ToList();
        var assemblyProcessor = new AssemblyProcessor(freezeCheckerInjector, implementsInterfaceFinder, LogInfo);

        assemblyProcessor.Execute(classes);

        volatileFieldFixer.Execute(classes);
    }
Exemple #3
0
        public void Execute()
        {
            typeResolver = new TypeResolver();

            var bindableBaseTypeFinder = new TypeFinder(ModuleDefinition, AssemblyResolver, BINDABLE_BASE);

            bindableBaseType = bindableBaseTypeFinder.Execute();

            // Find the ConnectChild () method
            var connectFinder = new MethodFinder(ModuleDefinition, CONNECT, 3);

            connectMethod = connectFinder.Execute(bindableBaseType);

            // Get a list of all the classes deriving from BindableBase
            bindableTypes = new HashSet <TypeDefinition> (
                ModuleDefinition.GetTypes().Where(x => x.IsClass && IsBindableBaseType(x)));

            // Process BindableBase types to inject the ConnectChild () function
            foreach (var type in bindableTypes)
            {
                ProcessType(type);
            }
        }