blob: afd544245b239731fc70bf4709389aa455582a93 (
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 Mono.Cecil;
using System.Linq;
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>");
}
}
}
|