Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I edit Resource file at runtime

Tags:

c#

.net

asp.net

wcf

I have a WCF service, it response with JSON. I need to create a language file, which I can edit on production server. no problem if I will need to recycle App pool.

I was about to use Resource file, but I was worry that it is not editable by end user. I don't need to edit it pragmatically, the end user will edit it by opening the file in notepad without recompiling the application.

What do you suggest?

Thanks

like image 817
Costa Avatar asked Nov 04 '12 13:11

Costa


People also ask

How do I edit a RESX file?

Go to Settings >> Site Settings >> Languages, then click the language editor symbol (the most right one in the line with the language that looks like some kind of letters). Select the resource file and make your changes.

What is the extension of resource file?

A resource file is a text file with the extension . rc. The file can use single-byte, double-byte, or Unicode characters.

How do RESX files work?

A . resx file contains a standard header, which describes the format of the resource entries and specifies the versioning information for the XML that is used to parse the data. The resource file data follows the XML header.


2 Answers

Yes you can using the ResXResourceWriter class.

If you need to generate the Designer.cs file as well see this question Programmatically generate Designer.cs for resx file (ResXResourceWriter/ResXResourceReader)

If you need to modify the existing resx files see this question Modifying .resx file in c#

like image 114
Stefan P. Avatar answered Sep 30 '22 03:09

Stefan P.


According to MSDN, you can add new resource at runtime:

You can incrementally add resources for new cultures after you have deployed an application. Because subsequent development of culture-specific resources can require a significant amount of time, this allows you to release your main application first, and deliver culture-specific resources at a later date.

http://msdn.microsoft.com/en-us/library/sb6a8618%28v=vs.110%29.aspx

I think editing current resource will also work.

like image 45
Vương Tự Do Avatar answered Sep 30 '22 03:09

Vương Tự Do