| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The Facile API is capable of reading (decompiling) .Net assemblies. Covering the metadata tables, the embedded types and methods, including their bodies as CIL (bytecode).
(Previously hosted on https://code.google.com/p/facile-api/)
Initially the Facile API has been written to perform analysis of .Net assemblies, independet of the authoring .Net language.
This is just code to get an idea of the API. Please also use the available JavaDoc.
try {
//specify a path, where to find the assembly
String assemblyName = "mscorlib.dll";
String assemblyLocation = "../path/to/assembly/" + assemblyName;
//reflect and load the assembly using the Facile factory
Assembly assembly = Facile.loadAssembly(assemblyLocation);
//perform your custom operations on the assembly...
System.out.println("All defined types in " + assemblyName + ":\n");
for(Type type : assembly.getAllTypes()) {
System.out.println(type);
}
} catch (Exception e) {
e.printStackTrace();
}try {
//create a reflector object for later access (ILAsmRenderer)
FacileReflector facileReflector =
Facile.load("../somewhere/myAssembly.exe",
"../somewhere/myOptionalProgramDebugDatabase.pdb");
//load the assembly
Assembly assembly = facileReflector.loadAssembly();
if(assembly!=null) {
//output some useful information
System.out.println(assembly.toExtendedString());
//generate output
ILAsmRenderer renderer = new ILAsmRenderer(facileReflector);
renderer.renderSourceFilesToDirectory(
assembly,
System.getProperty("user.dir"));
//print out the location of the files
System.out.println("Generated decompiled files in: " +
System.getProperty("user.dir"));
} else {
System.out.println("File maybe contains only resources...");
}
} catch (DotNetContentNotFoundException e) {
//maybe you selected a native executeable...
System.out.println("No .Net content found...");
e.printStackTrace();
} catch (IOException e) {
//in case of missing file acces rights or similar problems
e.printStackTrace();
} catch (Exception e) {
//everything else
e.printStackTrace();
}There is an Eclipse project and a jardesc file in the repository which you can use to build the jar file.
All required configurations can be found in the Eclipse 'Run' and 'External Tools' dialog. For 'External Tools' -> 'Run ILAsm' you need a binary of ILAsm (comes with Visual Studio) Run Configurations in Eclipse. The following configurations have been tested (others are for sure possible):
Dev Configurations
Unit Test Configurations
External Tools Configurations in Eclipse
Additional: Sometimes a program like Total Commader http://www.totalcmd.net/ is useful to copy assemblies from the GAC to a desired location!
There is an older binary available here: http://tomsmartbishop.github.io/facile-api/
The Facile API is commercially used by the Sonargraph Explorer: http://www.hello2morrow.com
| Back | FazBrowse Home | New Git URL |