Repository navigation
Expand file tree
/
Copy pathModuleWeaver.cs
More file actions
51 lines (44 loc) · 1.44 KB
/
Copy pathModuleWeaver.cs
File metadata and controls
51 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections.Generic;
using System.Linq;
using Fody;
using Mono.Cecil;
public partial class ModuleWeaver: BaseModuleWeaver
{
List<TypeDefinition> types;
ParameterFormattingProcessor parameterFormattingProcessor = new();
public ModuleWeaver()
{
ReferenceCopyLocalPaths = new();
}
public override void Execute()
{
types = ModuleDefinition.GetTypes().ToList();
FindReferences();
FindInterceptor();
if (LogMethodIsNop)
{
var logMethod = GetPreferredLogMethod();
WriteDebug($"'{logMethod?.FullName}' is a Nop so skipping weaving");
RemoveAttributes();
return;
}
CheckForBadAttributes();
ProcessAssembly();
RemoveAttributes();
}
// TimeSpan first, then long
MethodReference GetPreferredLogMethod() =>
LogWithMessageMethodUsingTimeSpan ?? LogMethodUsingTimeSpan ?? LogWithMessageMethodUsingLong ?? LogMethodUsingLong;
public override IEnumerable<string> GetAssembliesForScanning()
{
yield return "System.Runtime.Extensions";
yield return "System";
yield return "mscorlib";
yield return "System.Diagnostics.TraceSource";
yield return "System.Diagnostics.Debug";
yield return "System.Runtime";
yield return "System.Reflection";
yield return "netstandard";
}
public override bool ShouldCleanReference => true;
}