Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How can I filterresources from an external assembly by type (text, icons, etc.)?

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

Scheduled Pinned Locked Moved C#
questioncsharphardwarehelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Erik
    wrote on last edited by
    #1

    Hello, 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:

    Assembly target = Assembly.LoadFile(filename);
    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 resource entry I currently get, i.e. if it's an icon, a text resource, or something else?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups