473,770 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to enumerate embedded resources???

Hello,

I'd like to be able to enumerate resources in embedded .resources files like
it is possible with external .resources files using the ResourceReader
class.
Is there a way to do such a thing???

Bob Rock
Nov 16 '05 #1
5 10284
See ResourceReader. GetEnumerator()

Pete

"Bob Rock" <no************ *************** @hotmail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hello,

I'd like to be able to enumerate resources in embedded .resources files like it is possible with external .resources files using the ResourceReader
class.
Is there a way to do such a thing???

Bob Rock

Nov 16 '05 #2
<pd******@hotma il.com> wrote in message
news:4f******** *************** *******@news.me ganetnews.com.. .
See ResourceReader. GetEnumerator()

Pete


Pete,

if I'm not mistaken ResourceReader works only on external resources ... not
embedded ones.

Bob Rock
Nov 16 '05 #3
Try:

Assembly executingAssemb ly = GetExecutingAss embly();

foreach ( string resourceName in
executingAssemb ly.GetManifestR esourceNames() )

{

Console.WriteLi ne( resourceName );

}

Tales from the SharpSide
http://www.scottcreynolds.com

Bob Rock wrote:
Hello,

I'd like to be able to enumerate resources in embedded .resources files like
it is possible with external .resources files using the ResourceReader
class.
Is there a way to do such a thing???

Bob Rock

Nov 16 '05 #4
> Try:

Assembly executingAssemb ly = GetExecutingAss embly();

foreach ( string resourceName in
executingAssemb ly.GetManifestR esourceNames() )

{

Console.WriteLi ne( resourceName );

}


Yes, and what if I want the get the resource itself (not its name)????

Bob Rock
Nov 16 '05 #5
Check this out:
http://www.scottcreynolds.com/PermaL...e-afa25eb48ff5

basically, once you have the name (or you could do it by index if you
know the order) you can:

Assembly a = Assembly.GetExe cutingAssembly( );
Stream myStream = a.GetManifestRe sourceStream(as semblyName);

now you can do whatever, like, if it's an image resource:

Image theImage = Bitmap.FromStre am(myStream);

--------------------------------
| Scott C. Reynolds |
| Tales from the SharpSide |
| http://www.scottcreynolds.com |
--------------------------------
Bob Rock wrote:
Try:

Assembly executingAssemb ly = GetExecutingAss embly();

foreach ( string resourceName in
executingAsse mbly.GetManifes tResourceNames( ) )

{

Console.Write Line( resourceName );

}

Yes, and what if I want the get the resource itself (not its name)????

Bob Rock

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
761
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: I've added a few files (images) to an assembly as embedded resources. Within the project folder these files are in a subfolder named "images".
5
8230
by: Drew | last post by:
Assembly asm = Assembly.GetExecutingAssembly(); me = new Bitmap(asm.GetManifestResourceStream("me.gif")); I have used this before without any problem, but now I get: An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: 'null' is not a valid value for 'stream'.
0
1676
by: Chris Schremser | last post by:
I have a question regarding embedded controls in IE. We are looking to replace a small VB ActiveX control with something written in C#. We have written the control and it instantiates correctly in IE using the <object> tag. My question is this. When the browser visits the pages and requests the object from the server, it appears to be making many unnecessary requests for configuration files and resources files as well. I am using the...
2
1895
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML files. My application will load the resources into memory as they are needed. I would like to be able to read and write to these embedded resources. Is it possible to write to an embedded resource within an assembly? If so, how? If it's not...
7
5430
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to need to be updated with the current copy before being built. I also don't want projects being built with the old copy. Thanks! Bill
6
13326
by: Rich Crusco via DotNetMonster.com | last post by:
I am looking for a way to convert the following vbs script to c# Const ADS_SECURE_AUTHENTICATION = 1 strADMIN = "adminaccount" strPASSWORD = "password" strUSER = "useraccount" Set dso = GetObject("WinNT:") Set srv = DSO.OpenDSObject("WinNT://servername/LanmanServer", strADMIN, strPASSWORD, ADS_SECURE_AUTHENTICATION) Set colResources = srv.Resources
4
5893
by: Jon Rista | last post by:
I have a project where I need to create a windows .exe by compiling code and linking in some resources. This program thats being generated is somewhat unconventional, and I'll explain how. I'm generating a very simple installer app that embeds referenced .dll files inside it, which are extracted and referenced when the installer app is executed. This works great when the installer app is built with Visual Studio .NET, but it does not work...
0
2199
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have multiple web forms. When you compile the application, it creates a DLL. If you view this DLL using ILDASM (the manifest), it shows info about the resources stored in the DLL. There is essentially an embedded resource "section" for each web form. The...
2
2419
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the namespace "EmbeddedResources" My resources are not included when the content is rendered in the browser. I have marked my JavaScript resource as Embedded. I am able to retrieve the path to the resource from the WebResource.axd HTTP Handler during...
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.