コード例 #1
0
ファイル: Program.cs プロジェクト: paulcbetts/stiletto
        public static void Main(string[] args)
        {
            var asm = args.Length > 0
                ? args[0]
                : @"C:\Users\ben\Development\stiletto\Stiletto.Test\bin\Debug\Stiletto.Test.dll";
            var ad = AssemblyDefinition.ReadAssembly(asm, new ReaderParameters { ReadSymbols = true });
            var md = ad.MainModule;

            var weaver = new ModuleWeaver()
                             {
                                 LogError = Console.WriteLine,
                                 ModuleDefinition = md,
                                 ReferenceCopyLocalPaths = new List<string>(),
                                 AssemblyResolver = new DefaultAssemblyResolver(),
                             };

            weaver.Execute();

            ad.Write(asm, new WriterParameters() { WriteSymbols = true });
        }
コード例 #2
0
ファイル: ModuleWeaver.cs プロジェクト: anaisbetts/stiletto
 public ErrorReporter(ModuleWeaver weaver)
 {
     this.weaver = weaver;
 }
コード例 #3
0
 public ErrorReporter(ModuleWeaver weaver)
 {
     this.weaver = weaver;
 }
コード例 #4
0
ファイル: FodyHelper.cs プロジェクト: benjamin-bader/stiletto
        public ModuleDefinition ProcessAssembly()
        {
            logger.Debug("Reading assembly {0}...", assemblyPath);
            var assemblyDefinition = AssemblyDefinition.ReadAssembly(assemblyPath);

            logger.Debug("Assembly read.  Processing...");
            var moduleWeaver = new ModuleWeaver
                               {
                                   AssemblyResolver = CreateAssemblyResolver(),
                                   Config = CreateFodyConfig(),
                                   LogError = message => Errors.Add(message),
                                   LogWarning = message => Warnings.Add(message),
                                   ProjectDirectoryPath = projectPath,
                                   ReferenceCopyLocalPaths = GetCopyLocalAssemblies(assemblyPath),
                                   ModuleDefinition = assemblyDefinition.MainModule
                               };

            try
            {
                DoInWorkingDirectory(Path.GetDirectoryName(assemblyPath), moduleWeaver.Execute);
            }
            catch (Exception ex)
            {
                logger.DebugException("Fody processing failed for assembly at " + assemblyPath, ex);
                WeaverException = ex;
            }

            return assemblyDefinition.MainModule;
        }