如何从 .NET 程序集反编译创建的 .resources 文件中提取图像?
我正在努力为我的客户恢复应用程序的源代码。我已成功使用 .NET Reflector 恢复应用程序代码。但现在我想整理代码并重新创建各个表单,以便我拥有每个表单的代码隐藏、设计器和 resx 文件。问题是所有图像都位于“.resources”文件中。如何从 Reflector 生成的这些“.resources”文件中提取图像?
我更愿意使用一些工具,而不是必须以编程方式提取图像,但如果我找不到合适的应用程序,我将诉诸代码。因此,我希望有人以前做过此操作,或者知道这些资源文件的查看器(最好是免费的!),可以让我提取图像。否则,代码也很好;因为我可以编写自己的小应用程序来提取图像。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以保存
.resources
文件,然后使用 resgen 工具(VS2010 工具的一部分)将其转换回.resx
文件,使用如下命令行:然后可以将
.resx
添加到 C# 项目中。完成此操作后,如果您尝试打开单个图像,VS2010 会将它们提取到独立的图像文件中。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: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.这个程序可以帮助你
http://www.codeproject.com/KB/dotnet/Extracting_Embedded_Image.aspx
This program help you
http://www.codeproject.com/KB/dotnet/Extracting_Embedded_Image.aspx
ILSpy 应该完成这项工作 - 请参阅 http://wiki.sharpdevelop.net 的功能/ILSpy.ashx 和下面的屏幕截图。
ILSpy should do this job - see features at http://wiki.sharpdevelop.net/ILSpy.ashx and the screenshot below.
JustDecompile 可以做到这一点。您可以右键单击资源并从上下文菜单中选择“保存”。
JustDecompile can do that. You can right-click on a resource and select Save from the context menu.