-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Nasha
Message 1 in Discussion

 
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 <DIR> 
.txt files from .resources or .resx files.  
.resources files from text or .resx files.  
.resx files from text or .resources files. </DIR> 
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) 
 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to