Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all embedded resources in another assembly

I'm working on localization for my project. For this, I have a class which should load an embedded resource from another assembly, and then read out the strings.

But also I need to know which resource files this assembly contains. The number and which languages those are, is unknown.

So how do I find out how the ".resx" file in this assembly is named? Those all have the same scheme: "de-DE.resx", "en-US.resx", and so on.

I need to know how many of those files are contained in this assembly, and which languages they are.

I know that the ResourceManager has access to them, thus it should be possible to access this information programatically too...

like image 722
SharpShade Avatar asked Jul 07 '12 18:07

SharpShade


1 Answers

You should use GetManifestResourceNames method from Assembly class (msdn):

string[] resourceNames = this.GetType().Assembly.GetManifestResourceNames();
foreach(string resourceName in resourceNames)
{
    Console.WriteLine(resourceName);
}
like image 76
kmatyaszek Avatar answered Sep 28 '22 09:09

kmatyaszek