示例#1
0
    public override void Execute()
    {
        var referenceFinder = new ReferenceFinder(ModuleDefinition, FindType);

        referenceFinder.Execute();
        var allTypes = ModuleDefinition.GetTypes().ToList();

        var finder = new MethodFinder(allTypes);

        finder.Execute();
        var converter = new FieldToPropertyConverter(this, referenceFinder, ModuleDefinition.TypeSystem, allTypes);

        converter.Execute();
        var forwarder = new FieldToPropertyForwarder(this, converter, referenceFinder, finder);

        forwarder.Execute();
    }
示例#2
0
    public void Execute()
    {
        var msCoreReferenceFinder = new ReferenceFinder
            {
                ModuleDefinition = ModuleDefinition,
                AssemblyResolver = AssemblyResolver
            };
        msCoreReferenceFinder.Execute();

        var interceptorFinder = new InterceptorFinder
            {
                ModuleDefinition = ModuleDefinition
            };
        interceptorFinder.Execute();

        var methodProcessor = new MethodProcessor
            {
                referenceFinder = msCoreReferenceFinder,
                typeSystem = ModuleDefinition.TypeSystem, InterceptorFinder = interceptorFinder,
            };
        foreach (var typeDefinition in ModuleDefinition.GetTypes())
        {
            if (typeDefinition.ContainsTimeAttribute())
            {
                methodProcessor.Process(typeDefinition.Methods.Where(x => !x.IsAbstract));
                continue;
            }
            foreach (var method in typeDefinition.Methods)
            {
                if (method.IsAbstract)
                {
                    continue;
                }
                if (!method.ContainsTimeAttribute())
                {
                    continue;
                }
                methodProcessor.Process(method);
            }
        }
    }