473,626 Members | 3,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the names of all the REsources embedded in a REsource File

How to get the names of all the Resources embedded in a Resource File?

-SARADHI

Nov 16 '05 #1
3 1727
you can view them in Reflector

programmaticall y :

string[] manifestResourc eNames = loadedAssembly. GetManifestReso urceNames();

Av.
http://dotnetjunkies.com/WebLog/avnrao
http://www28.brinkster.com/avdotnet

"Saradhi" <up*******@inoo ga.com> wrote in message news:eC******** ******@TK2MSFTN GP15.phx.gbl...
How to get the names of all the Resources embedded in a Resource File?

-SARADHI

Nov 16 '05 #2
If it's a resources file, load it with ResourceReader and use GetEnumerator to return an IDictionaryEnum erator. If the resources are in a satellite assembly load them with a ResourceManager and get the resource set required. You must know the culture that you're searching for.

After my signature a simple application demonstrates using a resourcereader.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
using System;

using System.Resource s;

using System.Drawing;

using System.Collecti ons;

using System.Componen tModel;

using System.Windows. Forms;

using System.Data;

namespace resourceenumera tor

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows. Forms.Form

{

private System.Windows. Forms.Button button1;

private System.Windows. Forms.Button button2;

private System.Windows. Forms.TextBox textBox1;

/// <summary>

/// Required designer variable.

/// </summary>

private System.Componen tModel.Containe r components = null;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeCompo nent();

//

// TODO: Add any constructor code after InitializeCompo nent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Disp ose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeCompo nent()

{

this.button1 = new System.Windows. Forms.Button();

this.button2 = new System.Windows. Forms.Button();

this.textBox1 = new System.Windows. Forms.TextBox() ;

this.SuspendLay out();

//

// button1

//

this.button1.Lo cation = new System.Drawing. Point(208, 200);

this.button1.Na me = "button1";

this.button1.Ta bIndex = 0;

this.button1.Te xt = "Open";

this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);

//

// button2

//

this.button2.Lo cation = new System.Drawing. Point(208, 232);

this.button2.Na me = "button2";

this.button2.Ta bIndex = 1;

this.button2.Te xt = "Quit";

this.button2.Cl ick += new System.EventHan dler(this.butto n2_Click);

//

// textBox1

//

this.textBox1.L ocation = new System.Drawing. Point(8, 8);

this.textBox1.M ultiline = true;

this.textBox1.N ame = "textBox1";

this.textBox1.S ize = new System.Drawing. Size(272, 184);

this.textBox1.T abIndex = 2;

this.textBox1.T ext = "";

//

// Form1

//

this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);

this.ClientSize = new System.Drawing. Size(292, 266);

this.Controls.A dd(this.textBox 1);

this.Controls.A dd(this.button2 );

this.Controls.A dd(this.button1 );

this.FormBorder Style = System.Windows. Forms.FormBorde rStyle.FixedDia log;

this.Name = "Form1";

this.Text = "Form1";

this.ResumeLayo ut(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run (new Form1());

}

private void button1_Click(o bject sender, System.EventArg s e)

{

OpenFileDialog dlg=new OpenFileDialog( );

dlg.Filter="Res ource files|*.resourc es";

if(dlg.ShowDial og()==DialogRes ult.OK)

{

ResourceReader rr=new ResourceReader( dlg.FileName);

IDictionaryEnum erator en = rr.GetEnumerato r();

while(en.MoveNe xt())

this.textBox1.T ext+=en.Key+"\r \n";

}

}

private void button2_Click(o bject sender, System.EventArg s e)

{

Application.Exi t();

}

}

}

"Saradhi" <up*******@inoo ga.com> wrote in message news:eC******** ******@TK2MSFTN GP15.phx.gbl...
How to get the names of all the Resources embedded in a Resource File?

-SARADHI

Nov 16 '05 #3
Thanks a Lot Bob.
It worked well.

-SARADHI
"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message news:Ot******** ******@TK2MSFTN GP11.phx.gbl...
If it's a resources file, load it with ResourceReader and use GetEnumerator to return an IDictionaryEnum erator. If the resources are in a satellite assembly load them with a ResourceManager and get the resource set required. You must know the culture that you're searching for.

After my signature a simple application demonstrates using a resourcereader.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
using System;

using System.Resource s;

using System.Drawing;

using System.Collecti ons;

using System.Componen tModel;

using System.Windows. Forms;

using System.Data;

namespace resourceenumera tor

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows. Forms.Form

{

private System.Windows. Forms.Button button1;

private System.Windows. Forms.Button button2;

private System.Windows. Forms.TextBox textBox1;

/// <summary>

/// Required designer variable.

/// </summary>

private System.Componen tModel.Containe r components = null;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeCompo nent();

//

// TODO: Add any constructor code after InitializeCompo nent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Disp ose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeCompo nent()

{

this.button1 = new System.Windows. Forms.Button();

this.button2 = new System.Windows. Forms.Button();

this.textBox1 = new System.Windows. Forms.TextBox() ;

this.SuspendLay out();

//

// button1

//

this.button1.Lo cation = new System.Drawing. Point(208, 200);

this.button1.Na me = "button1";

this.button1.Ta bIndex = 0;

this.button1.Te xt = "Open";

this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);

//

// button2

//

this.button2.Lo cation = new System.Drawing. Point(208, 232);

this.button2.Na me = "button2";

this.button2.Ta bIndex = 1;

this.button2.Te xt = "Quit";

this.button2.Cl ick += new System.EventHan dler(this.butto n2_Click);

//

// textBox1

//

this.textBox1.L ocation = new System.Drawing. Point(8, 8);

this.textBox1.M ultiline = true;

this.textBox1.N ame = "textBox1";

this.textBox1.S ize = new System.Drawing. Size(272, 184);

this.textBox1.T abIndex = 2;

this.textBox1.T ext = "";

//

// Form1

//

this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);

this.ClientSize = new System.Drawing. Size(292, 266);

this.Controls.A dd(this.textBox 1);

this.Controls.A dd(this.button2 );

this.Controls.A dd(this.button1 );

this.FormBorder Style = System.Windows. Forms.FormBorde rStyle.FixedDia log;

this.Name = "Form1";

this.Text = "Form1";

this.ResumeLayo ut(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run (new Form1());

}

private void button1_Click(o bject sender, System.EventArg s e)

{

OpenFileDialog dlg=new OpenFileDialog( );

dlg.Filter="Res ource files|*.resourc es";

if(dlg.ShowDial og()==DialogRes ult.OK)

{

ResourceReader rr=new ResourceReader( dlg.FileName);

IDictionaryEnum erator en = rr.GetEnumerato r();

while(en.MoveNe xt())

this.textBox1.T ext+=en.Key+"\r \n";

}

}

private void button2_Click(o bject sender, System.EventArg s e)

{

Application.Exi t();

}

}

}

"Saradhi" <up*******@inoo ga.com> wrote in message news:eC******** ******@TK2MSFTN GP15.phx.gbl...
How to get the names of all the Resources embedded in a Resource File?

-SARADHI

Nov 16 '05 #4

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

Similar topics

3
12645
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the language. (en\*.resources, en-US\*.resources ...) With al.exe I generating several dlls with the format applicationname.resource.dll (in every language-folders one dll)
1
2288
by: Stefan Turalski \(stic\) | last post by:
Hi, What I need to do is adding some support for resources files to my application. What I did is: MyAppMain <- startup project MyAppHelper <- project which has MyAppResourcesClass (al a library project) This class call methode : ResourceManager MyAppResourceManager = new ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly()); and I obtain error which tell that there is no propertly added
1
3836
by: D. Yates | last post by:
Hi, I am looking for an example of how to extract bitmap images from an embedded resource file (a file with *.res extension, which can be viewed inside of the ide and can hold bitmaps, icons, string tables, etc.) and place them into a imagelist. I have found examples using the resource manager to create a "resource file" like so: ResourceWriter rw = new ResourceWriter (
4
5878
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...
1
2504
by: farseer | last post by:
Hi, I created a new resouce ("app.resx") in my project and added an icon to this resource with name "IL_ICON". I would like to use this resource in some unmanaged code, in particular, with the api function SHNotificationAdd. How can i do this? i have tried using ResourceManager to get that icon, but i am getting back NULL. Even if i did get back an icon, how can i use this to with the hIcon parameter of SHNotificationAdd? thank you...
0
1560
by: Chris Morse | last post by:
Hi, I am creating a solution with two projects. Basically, they share a few common class files and forms. I finished one project, and it compiles and runs fine. I just finished bringing in the second project, and I get the following error on one of the forms when it is invoked: ----------------------------------------------------------------- An unhandled exception of type
0
2959
by: Mythran | last post by:
I wrote some code that is supposed to enumerate through the specified file's win32 resources and return a string-array of all icon names. When it runs, it returns a string-array with a bunch of numbers in sequential order (1-55 when ran against iexplore.exe). When I open up iexplore.exe in Visual Studio, I see 23 icons. Each icon has 1 or more sizes of the icon...I'm assuming that there are, in fact, 55 icon resources in iexplore.exe,...
8
2449
by: Fred* | last post by:
Hello, I'm using Visual C# 2005 Express. if I create a new "application windows" project and run it (F5), it works well. (an empty window is launched..) as soon as I set the build action to embedded resource, I can't run it anymore because I got an error on 'WindowsApplication1.Form1.Dispose(bool)'..
2
2411
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
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8364
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,...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
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.