public void Run() { if (this.Exports == null) { IExportAssemblyInspector assemblyInspector = Utilities.CreateAssemblyInspector(this.InputValues); using (this.GetNotifier().CreateContextName((object)this, Resources.ExtractExportsContextName)) this.Exports = assemblyInspector.ExtractExports(); using (this.GetNotifier().CreateContextName((object)this, Resources.FindDuplicateExportMethodsContextName)) { foreach (DuplicateExports duplicateExportMethod in this.Exports.DuplicateExportMethods) { if (duplicateExportMethod.Duplicates.Count > 0) { StringBuilder stringBuilder = new StringBuilder(200).AppendFormat("{0}.{1}", (object)duplicateExportMethod.UsedExport.ExportedClass.NullSafeCall <ExportedClass, string>((Func <ExportedClass, string>)(ec => ec.FullTypeName)), (object)duplicateExportMethod.UsedExport.Name); foreach (ExportedMethod duplicate in (IEnumerable <ExportedMethod>)duplicateExportMethod.Duplicates) { stringBuilder.AppendFormat(", {0}.{1}", (object)duplicate.ExportedClass.NullSafeCall <ExportedClass, string>((Func <ExportedClass, string>)(ec => ec.FullTypeName)), (object)duplicate.Name); } } } } } if (this.Exports.Count == 0) { return; } using (this.GetNotifier().CreateContextName((object)this, Resources.CreateTempDirectoryContextName)) { using (ValueDisposable <string> tempDirectory = Utilities.CreateTempDirectory()) { this.RunIlDasm(tempDirectory.Value); bool flag = ((IEnumerable <string>) new string[2] { "true", "yes" }).Any <string>((Func <string, bool>)(t => t.Equals(this.InputValues.LeaveIntermediateFiles, StringComparison.InvariantCultureIgnoreCase))); if (flag) { using (this.GetNotifier().CreateContextName((object)this, Resources.CopyBeforeContextName)) DllExportWeaver.CopyDirectory(tempDirectory.Value, Path.Combine(Path.GetDirectoryName(this.InputValues.OutputFileName), "Before"), true); } using (IlAsm ilAsm = this.PrepareIlAsm(tempDirectory.Value)) this.RunIlAsm(ilAsm); if (!flag) { return; } using (this.GetNotifier().CreateContextName((object)this, Resources.CopyAfterContextName)) DllExportWeaver.CopyDirectory(tempDirectory.Value, Path.Combine(Path.GetDirectoryName(this.InputValues.OutputFileName), "After"), true); } } }
public void Run() { if (this.Exports == null) { IExportAssemblyInspector assemblyInspector = Utilities.CreateAssemblyInspector(this.InputValues); using (this.GetNotifier().CreateContextName((object)this, Resources.ExtractExportsContextName)) this.Exports = assemblyInspector.ExtractExports(); using (this.GetNotifier().CreateContextName((object)this, Resources.FindDuplicateExportMethodsContextName)) { foreach (DuplicateExports duplicateExportMethod in this.Exports.DuplicateExportMethods) { if (duplicateExportMethod.Duplicates.Count > 0) { StringBuilder stringBuilder = new StringBuilder(200).AppendFormat("{0}.{1}", (object)duplicateExportMethod.UsedExport.ExportedClass.NullSafeCall <ExportedClass, string>((Func <ExportedClass, string>)(ec => ec.FullTypeName)), (object)duplicateExportMethod.UsedExport.Name); foreach (ExportedMethod duplicate in (IEnumerable <ExportedMethod>)duplicateExportMethod.Duplicates) { stringBuilder.AppendFormat(", {0}.{1}", (object)duplicate.ExportedClass.NullSafeCall <ExportedClass, string>((Func <ExportedClass, string>)(ec => ec.FullTypeName)), (object)duplicate.Name); } } } } } if (Exports.Count == 0) { return; } using (GetNotifier().CreateContextName(this, Resources.CreateTempDirectoryContextName)) using (var dir = new TempDir()) { RunIlDasm(dir.FullPath); void _ilasm() => RunIlAsm(dir.FullPath); if (InputValues.LeaveIntermediateFiles.IsTrue()) { MakeWithIntermediateFiles(dir, _ilasm); return; } _ilasm(); } }