473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 1713
you can view them in Reflector

programmatically :

string[] manifestResourceNames = loadedAssembly.GetManifestResourceNames();

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

"Saradhi" <up*******@inooga.com> wrote in message news:eC**************@TK2MSFTNGP15.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 IDictionaryEnumerator. 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.Resources;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace resourceenumerator

{

/// <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.ComponentModel.Container components = null;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

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 InitializeComponent()

{

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

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

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

this.SuspendLayout();

//

// button1

//

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

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "Open";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// button2

//

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

this.button2.Name = "button2";

this.button2.TabIndex = 1;

this.button2.Text = "Quit";

this.button2.Click += new System.EventHandler(this.button2_Click);

//

// textBox1

//

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

this.textBox1.Multiline = true;

this.textBox1.Name = "textBox1";

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

this.textBox1.TabIndex = 2;

this.textBox1.Text = "";

//

// Form1

//

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

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

this.Controls.Add(this.textBox1);

this.Controls.Add(this.button2);

this.Controls.Add(this.button1);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

this.Name = "Form1";

this.Text = "Form1";

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void button1_Click(object sender, System.EventArgs e)

{

OpenFileDialog dlg=new OpenFileDialog();

dlg.Filter="Resource files|*.resources";

if(dlg.ShowDialog()==DialogResult.OK)

{

ResourceReader rr=new ResourceReader(dlg.FileName);

IDictionaryEnumerator en = rr.GetEnumerator();

while(en.MoveNext())

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

}

}

private void button2_Click(object sender, System.EventArgs e)

{

Application.Exit();

}

}

}

"Saradhi" <up*******@inooga.com> wrote in message news:eC**************@TK2MSFTNGP15.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@_spamkiller_bobpowell.net> wrote in message news:Ot**************@TK2MSFTNGP11.phx.gbl...
If it's a resources file, load it with ResourceReader and use GetEnumerator to return an IDictionaryEnumerator. 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.Resources;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace resourceenumerator

{

/// <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.ComponentModel.Container components = null;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

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 InitializeComponent()

{

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

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

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

this.SuspendLayout();

//

// button1

//

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

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "Open";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// button2

//

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

this.button2.Name = "button2";

this.button2.TabIndex = 1;

this.button2.Text = "Quit";

this.button2.Click += new System.EventHandler(this.button2_Click);

//

// textBox1

//

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

this.textBox1.Multiline = true;

this.textBox1.Name = "textBox1";

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

this.textBox1.TabIndex = 2;

this.textBox1.Text = "";

//

// Form1

//

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

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

this.Controls.Add(this.textBox1);

this.Controls.Add(this.button2);

this.Controls.Add(this.button1);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

this.Name = "Form1";

this.Text = "Form1";

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void button1_Click(object sender, System.EventArgs e)

{

OpenFileDialog dlg=new OpenFileDialog();

dlg.Filter="Resource files|*.resources";

if(dlg.ShowDialog()==DialogResult.OK)

{

ResourceReader rr=new ResourceReader(dlg.FileName);

IDictionaryEnumerator en = rr.GetEnumerator();

while(en.MoveNext())

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

}

}

private void button2_Click(object sender, System.EventArgs e)

{

Application.Exit();

}

}

}

"Saradhi" <up*******@inooga.com> wrote in message news:eC**************@TK2MSFTNGP15.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
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...
1
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...
1
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,...
4
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...
1
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...
0
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...
0
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...
8
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.