2017-09-25 16:57:44 +00:00
|
|
|
using System;
|
|
|
|
using Mono.Cecil;
|
2018-05-10 08:37:03 +00:00
|
|
|
using Mono.Linker;
|
2017-09-25 16:57:44 +00:00
|
|
|
|
2018-05-10 08:37:03 +00:00
|
|
|
public static class Utils
|
2017-09-25 16:57:44 +00:00
|
|
|
{
|
|
|
|
public static bool IsManagedAssembly (string fileName)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
ModuleDefinition module = ModuleDefinition.ReadModule (fileName);
|
|
|
|
return true;
|
|
|
|
} catch (BadImageFormatException) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2018-01-24 17:04:36 +00:00
|
|
|
|
2018-05-10 08:37:03 +00:00
|
|
|
public static bool IsCrossgenedAssembly (string fileName)
|
2018-01-24 17:04:36 +00:00
|
|
|
{
|
|
|
|
try {
|
|
|
|
ModuleDefinition module = ModuleDefinition.ReadModule (fileName);
|
2018-05-10 08:37:03 +00:00
|
|
|
return module.IsCrossgened ();
|
2018-01-24 17:04:36 +00:00
|
|
|
} catch (BadImageFormatException) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|