A ResourceCollection is a collection of Resource objects, so once you've loaded 
it, you can enumerate the resources in the collection. Resources may be of 
different ResourceTypes, and Resource instances of type Version will actually 
be a specialized VersionResource subclass. So to get to the strings in the 
version string table, you'll do something like this:

ResourceCollection rc = new ResourceCollection();
rc.Find(pathToDll, ResourceType.Version);
rc.Load(pathToDll);

foreach (Resource res in rc)
{
    if (res.ResourceType == ResourceType.Version)
    {
        foreach (VersionStringTable vst in (VersionResource)res)
        {
            if (vst.Locale == CultureInfo.CurrentCulture.LCID) // Or whatever 
LCID you're looking for
            {
                foreach (KeyValuePair<string, string> versionString in vst)
                {
                    // Key is the name of the resource; Value is the resource 
string.
                }

                // Or instead of enumerating KVPs, lookup a resource by name.
            }
        }
    }
}

The DTF Resources library is a very thin wrapper over the Win32 resource APIs. 
I primarily developed it only in support of some other functionality in DTF, so 
I didn't put a lot of effort into making it really easy to use or documenting 
lots of examples. But, it should serve your purpose well enough.

-Jason-


-----Original Message-----
From: jnewton [mailto:jonathan.new...@ni.com] 
Sent: Friday, March 18, 2011 6:31 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Using DTF to Retrieve String Entries in Resource DLL

I'm trying to use the Resource classes (i.e. Resource, ResourceCollection...) 
in the Microsoft.Deployment.Resources assembly that DTF ships to retrieve 
string entries from the RT_STRING table resource. I using the code:

ResourceCollection rc = new ResourceCollection(); rc.Find(pathToDll);
rc.Load(pathToDll)

This loads up all the correct information, but I'm not sure at this point how 
to get the string entries. I see there is a resource entry with type String 
which contains all the data I need. However, I note sure how to drill down to 
the VersionStringTable object if there is one.

Anybody got suggestions on how to do this? 

--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Using-DTF-to-Retrieve-String-Entries-in-Resource-DLL-tp6184522p6184522.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit for your organization - 
today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to