Execute() public method

public Execute ( ) : void
return void
コード例 #1
0
    public void Execute()
    {
        try
        {
            var referenceFinder = new AssemblyReferenceFinder(this, Logger);
            referenceFinder.Execute();
            var assemblyResolver = new AssemblyResolver(referenceFinder);
            var reader           = new ModuleReader
            {
                AssemblyResolver = assemblyResolver,
                InnerWeaver      = this,
                Logger           = Logger
            };
            reader.Execute();

            var weaverInitialiser = new WeaverInitialiser
            {
                ModuleDefinition = reader.ModuleDefinition,
                AssemblyResolver = assemblyResolver,
                InnerWeaver      = this,
                Logger           = Logger
            };
            weaverInitialiser.Execute();

            var weaverRunner = new ModuleWeaverRunner
            {
                Logger = Logger,
            };
            Logger.LogInfo("");
            foreach (var weaverInstance in weaverInitialiser.WeaverInstances)
            {
                var weaverName = ObjectTypeName.GetAssemblyName(weaverInstance);
                Logger.SetCurrentWeaverName(weaverName);
                try
                {
                    weaverRunner.Execute(weaverInstance);
                }
                catch (Exception exception)
                {
                    Logger.LogError(exception.ToFriendlyString());
                    return;
                }
                finally
                {
                    Logger.ClearWeaverName();
                }
            }

            var keyFinder = new StrongNameKeyFinder
            {
                InnerWeaver      = this,
                Logger           = Logger,
                ModuleDefinition = reader.ModuleDefinition
            };
            keyFinder.Execute();
            var moduleWriter = new ModuleWriter
            {
                InnerWeaver         = this,
                Logger              = Logger,
                ModuleDefinition    = reader.ModuleDefinition,
                StrongNameKeyFinder = keyFinder,
            };
            moduleWriter.Execute();
        }
        catch (Exception exception)
        {
            Logger.LogError(exception.ToFriendlyString());
        }
    }
コード例 #2
0
ファイル: InnerWeaver.cs プロジェクト: paulcbetts/Fody
    public void Execute()
    {
        try
        {

            var referenceFinder = new AssemblyReferenceFinder(this, Logger);
            referenceFinder.Execute();
            var assemblyResolver = new AssemblyResolver(referenceFinder);
            var reader = new ModuleReader
                             {
                                 AssemblyResolver = assemblyResolver,
                                 InnerWeaver = this,
                                 Logger = Logger
                             };
            reader.Execute();

            var weaverInitialiser = new WeaverInitialiser
                                        {
                                            ModuleDefinition = reader.ModuleDefinition,
                                            AssemblyResolver = assemblyResolver,
                                            InnerWeaver = this,
                                            Logger = Logger
                                        };
            weaverInitialiser.Execute();

            var weaverRunner = new ModuleWeaverRunner
                                   {
                                       Logger = Logger,
                                   };
            Logger.LogInfo("");
            foreach (var weaverInstance in weaverInitialiser.WeaverInstances)
            {
                var weaverName = ObjectTypeName.GetAssemblyName(weaverInstance);
                Logger.SetCurrentWeaverName(weaverName);
                try
                {
                    weaverRunner.Execute(weaverInstance);
                }
                catch (Exception exception)
                {
                    Logger.LogError(exception.ToFriendlyString());
                    return;
                }
                finally
                {
                    Logger.ClearWeaverName();
                }
            }

            var keyFinder = new StrongNameKeyFinder
                {
                    InnerWeaver = this,
                    Logger = Logger,
                    ModuleDefinition = reader.ModuleDefinition
                };
            keyFinder.Execute();
            var moduleWriter = new ModuleWriter
                                   {
                                       InnerWeaver = this,
                                       Logger = Logger,
                                       ModuleDefinition = reader.ModuleDefinition,
                                       StrongNameKeyFinder = keyFinder,
                                   };
            moduleWriter.Execute();

        }
        catch (Exception exception)
        {
            Logger.LogError(exception.ToFriendlyString());
        }
    }