blob: a953306d6a6cd1e66f46570350daa2d7bf04d407 (
plain)
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
|
using System;
using System.Linq;
using Mono.Cecil;
namespace ILLink.Tasks
{
public static class Utils
{
public static bool IsManagedAssembly (string fileName)
{
try {
ModuleDefinition module = ModuleDefinition.ReadModule (fileName);
return !IsCPPCLIAssembly (module);
} catch (BadImageFormatException) {
return false;
}
}
private static bool IsCPPCLIAssembly (ModuleDefinition module)
{
return module.Types.Any (t =>
t.Namespace == "<CppImplementationDetails>" ||
t.Namespace == "<CrtImplementationDetails>");
}
}
}
|