开发者

How can I filter resources from an external assembly by type (text, icons, etc.)?

开发者 https://www.devze.com 2023-03-21 23:51 出处:网络
I already figured out how to load another assembly from my C# application, and extract the resources embedded to that assembly. My problem is that I\'d like to filter the resources by type, i.e. I wan

I already figured out how to load another assembly from my C# application, and extract the resources embedded to that assembly. My problem is that I'd like to filter the resources by type, i.e. I want to get only text resources, but not icons and other stuff.

The code I use at the moment looks like this:

string[] list = target.GetManifestResourceNames();         
foreach (var listentry in list)
{
    Stream resourceStream = target.GetManifestResourceStream(listentry);        
    var rr = new ResourceReader(resourceStream);
    IDictionaryEnumerator dict = rr.GetEnumerator();
    int ctr = 0;
    while (dict.MoveNext())
    {
        ctr++;
        string entry = dict.Value; //I'd like to know what kind of resource this is, how can I do that?     
    }
    rr.Close();
}

How can I determine which kind of 开发者_JAVA技巧resource entry I currently get, i.e. if it's an icon, a text resource, or something else?

Thanks a lot.

0

精彩评论

暂无评论...
验证码 换一张
取 消