Use resourcereader and resxresourcewriter to convert resource files

Source: Internet
Author: User

When we use reflector to view the source code

Resource files are in the resources format.

Cannot be used directly in. net

Although the Code is obtained, the image cannot be restored.

Still chores

 

In fact, it is very easy to get the content in the resource file.

Ms provides resourcereader and resourcewriter as well as resxresourcereader and resxresourcewriter.

 

We can use these classes to convert resources and resx formats.

 

Suppose we have a resource file in the resources format.

 

Write the following code:

 

Resourcereader RR = new resourcereader (inputresources); <br/> string S = ""; <br/> byte [] B; <br/> RR. getresourcedata ("key", out S, out B); <br/> RR. close ();

 

Inputresources is the resource file to be read.

The returned S is type, and B is the data in the resource file.

The key can be obtained from the decompiled code.

 

If we write the obtained data to the resx file

Resxresourcewriter rrw = new resxresourcewriter (outputresx); <br/> rrw. addmetadata ("key", B); <br/> rrw. generate (); <br/> rrw. close ();

Outputresx is a generated resource file in resx format.

 

Now, you can use the text editor to open the generated outputresx.

You can see the value in it.

In this way, you can recreate a resource file.

Then copy the value to use it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.