Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I extract images from the .resources file created by a decompile of a .NET assembly?

I am working on recovering the source for an application for a client of mine. I have managed to recover the application code using .NET Reflector. But now I want to neaten the code and recreate the individual forms so will that I have the codebehind, designer and resx files for each form. The problem is that all the images are located in ".resources" files. How do I extract the images from these ".resources" files that were generated by Reflector?

I would prefer to use some tool, rather than having to extract the images programmatically, but I will resort to code if I can't find a suitable application. So here I am hoping that someone has done this before or knows of a viewer (preferably free!) for these resources files that would allow me to extract the images. Otherwise, code is also good; as I could then write my own little application to extract the images.

like image 906
BruceHill Avatar asked Oct 04 '11 20:10

BruceHill


People also ask

Can C# be decompiled?

It can reliably decompile any . NET assembly into equivalent C# or IL code. The decompiler supports multiple formats including libraries (. dll), executables (.exe), and Windows metadata files (.


3 Answers

You can save the .resources file and then use the resgen tool (part of the VS2010 tools) to convert it back into a .resx file, using a command line like:

resgen foo.resources bar.resx

The .resx can then be added to a C# project. Once you've done this, if you try to open the individual images, VS2010 will offer to extract them into a standalone image file.

like image 179
Clive Tong Avatar answered Sep 23 '22 03:09

Clive Tong


This program help you http://www.codeproject.com/KB/dotnet/Extracting_Embedded_Image.aspx

like image 34
sepulka Avatar answered Sep 23 '22 03:09

sepulka


ILSpy should do this job - see features at http://wiki.sharpdevelop.net/ILSpy.ashx and the screenshot below.

screenshot

like image 44
poupou Avatar answered Sep 23 '22 03:09

poupou