If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

.NET Framework CLR Tools: How do I use the Resource File Generator?

A: The Resource File Generator converts '.txt' files and '.resx' (XML-based resource format) files to common language runtime binary '.resources' files that can be embedded in a runtime binary executable or compiled into satellite assemblies.

What conversions does the 'rResGen.exe' tool perform?

'Resgen.exe' performs the following conversions:

Converts '.txt' files to '.resources' or '.resx' files.

Converts '.resources' files to text or '.resx' files.

Converts '.resx' files to '.txt' or '.resources' files

What classes does the resource generator use?

'ResourceReader' class

'ResourceWriter' class

'ResXResourceReader' class

'ResXResourceWriter' class

What does the 'ResourceReader' class do?

The 'ResourceReader' provides a default implementation of the 'IResourceReader' interface.

You can use resource readers to read resource name and resource value pairs from '.resources' files.

The resources can be enumerated by traversing the 'IDictionaryEnumerator' returned by the 'GetEnumerator()' method.

The methods provided by the 'IDictionaryEnumerator' are used to advance to the next resource and read the name and value of each resource in the '.resources' file.

Can I have an example using the 'ResourceReader' class?

The following code sample displays the content of 'myResources.resources' file on the console:

Code:

Imports System
Imports System.Resources
Imports System.Collections
Public Class ReadResources
Public Shared Sub Main()
' Opens a resource reader and get an enumerator from it.
Dim reader As New ResourceReader("myResources.resources")
Dim en As IDictionaryEnumerator = reader.GetEnumerator()
' Goes through the enumerator, printing out the key and value pairs.
While en.MoveNext()
Console.WriteLine()
Console.WriteLine("Name: {0}", en.Key)
Console.WriteLine("Value: {0}", en.Value)
End While
reader.Close()
End Sub
End Class

What does the 'ResourceWriter' class do?

Writes resources in the system-default format to an output file or an output stream.

Can I have an example using the 'ResourceWriter' class?

The following example writes several strings into the 'myResources.resources' file:

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.