0

Assuming I have a wpf solution like the one below, how can I discover the file structure of "SatAssembly"?

- EntryAssembly
  -- code files

- SatAssembly
  -- GlobalizationFolder  
     -- en-US Folder  
         -- resourceDictionary.xaml  
     -- es-ES Folder  
         -- resourceDictionary.xaml  

MORE INFO

All I really want to wind up from the above example with is a set of strings "en-US' "es-Es"

I can use code below to get what I want, and I was wondering if there isn't a simpler way to get what are essentially directory names. Or is this as good as it gets?

var asm = Assembly.LoadFrom("SomeSatelliteAssembly.dll");
var stream = asm.GetManifestResourceStream(asm.GetName().Name + ".g.resources");
using (var reader = new ResourceReader(stream))
{
    foreach (var o in reader.Cast<DictionaryEntry>())
    {
        // massage the keys as needed
    }
}

// ** output of keys for "SatAssembly" ***
globalization/en-US/resourcedictionary.baml    
globalization/es-ES/resourcedictionary.baml
4

0 回答 0