When loading Resources through reflection, how can I be sure I am using the correct Resource Name when I call DLLAssembly.GetManifestResourceNames()
The result of that call is a String[] containing 2 elements.
SDKSetupTool.MainForm.resources
SDKSetupTool.Properties.Resources.resources
If I make the same call to a VB Assembly, it returns 2 elements as well.
SDKSetupTool.MainForm.resources
SDKSetupTool.Resources.resources
The Last element has always been the correct Location containing the Resources from my tests. However, why must I have to parse out ".resources" in order for the ResourceManager to be able to load the Resources
//Load the resource String so that we can bootstrap our Plugin
String RawResourceLocation = DLLAssembly.GetManifestResourceNames()[1];
String ResourceLocation = RawResourceLocation.Substring(0, RawResourceLocation.LastIndexOf('.'));
//Load the resources into a Resource Manager
System.Resources.ResourceManager rman = new System.Resources.ResourceManager(ResourceLocation, DLLAssembly);
//Plugin Name
String PluginName = rman.GetString("PluginName");
//Plugin Description
String PluginDesc = rman.GetString("PluginDescription");
//Plugin Language (Currently only C# and VB.NET Supported)
tring PluginLang = rman.GetString("PluginLanguage");
If I can consistently be able to load the Resources of an Assembly I will be able to load the plugin based on the String contained in the resources.
Aucun commentaire:
Enregistrer un commentaire