Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)

Reply
Thread Tools

Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)

 
 
Namratha Shah \(Nasha\)
Guest
Posts: n/a
 
      11-02-2004
Hi All,

This is a resource file generation tool which converts an xml based resource formats to .net resource file i.e. (.resources) and vice-versa.

Today we will see how we will generate

==> .txt files from .resources or .resx files.

==> .resources files from text or .resx files.

==> .resx files from text or .resources files.

Let us start with converting a .txt file to resources or resx file

In order to convert from one type to another we must ensure that the data written in them is in the correct format.

Text files can only contain string resources as name=value pairs. Name here is a string that describes the resource it needs to be

unique and the value is the resource string. All these name value pairs should start from a new line.

Lets create a text file containing 10 name=value pairs;

1) Create a text file name MyText.txt.


2) Type the below name=value pairs

name1=value
name2=value
name3=value
name4=value
name5=value
name6=value
name7=value
name8=value
name9=value
name10=value

3) Type the following command to generate MyResources.resx from MyText.txt.

4) If you duplicated any of the entires you will get the below error message.

error: Duplicate resource key!


Else your resources will be complied successfully with the following message.


Read in 10 resources from 'MyText.txt'
Writing resource file... Done.

5) To generate .resources file from .txt file use the following command resgen MyText.txt MyResources.resources

6) To genereate .txt from .resources file or .resx file use the following commands

resgen MyResources.resx MyTextFromRes.txt
resgen MyResources.resources MyTextFromResources.txt



7) To generate .txt file from resx file or .resource file use the following commands:

resgen MyResources.resx MyTextFromRes.txt
resgen MyResources.resources MyTextFromResources.txt

There are a certain advantages or disadvantages of these format over one another :

1) Text file format name=value pair is very convient ,easy to use and create but can contain only text strings and hence you cannot embed any objects in these files.


2) Resx file format has the data in the xml format and hence you can embed objects. You will also be able to view the binary information about these objects e.g. embedding images in the resource files.

Thus

..Resources file is a binary file which is used by the assemblies
..Resx has the data in an xml format
..txt has the data in name=value format .... gr8 so many ways to represent and use your data.

To use these resource files in your assembly( as a part of your assembly) you will need to embed or link it with main assembly using assembly linker or create satellite assembly.(We will look into detail about this in tommorrow's article).

-- Please post your queries and comments for my articles in the usergroup for the benefit of all. I hope this step from my end is helpful to all of us.

Regards,

Namratha (Nasha)


 
Reply With Quote
 
 
 
 
Rony.Swinburne Rony.Swinburne is offline
Junior Member
Join Date: Jul 2006
Posts: 1
 
      07-26-2006
Hi,

I'm student at Swinburne Uni, Melbourne. Write now I'm working on .resx files and related stuff and your article helps me.

Could you just let me know difference between UI-Resources and preference Data.

Thanks you in advance.

Cheers,
Rony
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Article : Security Tools Part -- 2 (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) ASP .Net Mobile 0 11-23-2004 04:01 PM
Article : Security Tools Part -- 2 (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) ASP .Net Security 0 11-23-2004 04:01 PM
Article : Security Tools Part -- 2 (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) ASP .Net Datagrid Control 0 11-23-2004 04:01 PM
Article : Security Tools Part -- 2 (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) ASP .Net 0 11-23-2004 04:01 PM
Re: Article: Permissions View Tool (Permview.exe .Net FrameWork Tools Series) Alvin Bruney [MVP] ASP .Net 0 11-02-2004 04:11 AM



Advertisments