473,800 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is there a way to inspect if a resource file is in the exe or not?

During compilation, I am including a resource file and I want to check
the exe to see if the resource file I added available?
Is there any other way to see what are all the resources available in
an assembly, without really knowing the names?
Thanks.
Jun 27 '08 #1
2 994
If you mean as a quick check, then Lutz to the rescue (again) via
Reflector, which shows resources for assemblies (or Resourcer for
working on resx pre-build): http://www.aisto.com/roeder/dotnet/

If you mean routinely through code - then you can find the resources
with things like:
http://groups.google.com/group/micro...bededfba28f246

But if the resource is a resx, you need to parse the resx stream -
something like below (crude and incomplete).

Marc

Assembly assembly = typeof(Program) .Assembly;
foreach (string name in
assembly.GetMan ifestResourceNa mes())
{
try
{
using (ResourceReader reader = new
ResourceReader( assembly.GetMan ifestResourceSt ream(name)))
{
foreach (DictionaryEntr y pair in reader)
{
Console.WriteLi ne("{0}: {1}", pair.Key,
pair.Value);
}
}
}
catch
{ // not a resx...?

}
}
Jun 27 '08 #2
On Apr 29, 3:02 am, Marc Gravell <marc.grav...@g mail.comwrote:
If you mean as a quick check, then Lutz to the rescue (again) via
Reflector, which shows resources for assemblies (or Resourcer for
working on resx pre-build):http://www.aisto.com/roeder/dotnet/

If you mean routinely through code - then you can find the resources
with things like:http://groups.google.com/group/micro...languages.csha...

But if the resource is a resx, you need to parse the resx stream -
something like below (crude and incomplete).

Marc

Assembly assembly = typeof(Program) .Assembly;
foreach (string name in
assembly.GetMan ifestResourceNa mes())
{
try
{
using (ResourceReader reader = new
ResourceReader( assembly.GetMan ifestResourceSt ream(name)))
{
foreach (DictionaryEntr y pair in reader)
{
Console.WriteLi ne("{0}: {1}", pair.Key,
pair.Value);
}
}
}
catch
{ // not a resx...?

}
}
excellent. Thanks.
Jun 27 '08 #3

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

Similar topics

1
2561
by: Thomas Guettler | last post by:
Hi, the line numbers of inspect.getinnerframes are different from traceback.format_exception. This results in wrong lines being shown in cgitb. An example is below. I looked at the source of both methods. One uses f_lineno (wrong)
2
1623
by: Fernando Perez | last post by:
Hi all, IPython has suffered quite a few problems with the inspect module in python 2.3. For these, unfortunately all I've been able to do is guard with overreaching except clauses, as I had not been able to find small, reproducible examples to pass on to the devs. But today I got a crash report from a user and I've been able to replicate this crash with a tiny script which does not depend on ipython at all. I'd like to hear from...
11
3960
by: It's me | last post by:
I discovered the hardway what inspect.isclass() is doing. Consider this no brainer code: ### import inspect class Abc: def Hello(self): return
4
2657
by: Benjamin Rutt | last post by:
I'm trying to learn about introspection in Python. my ultimate goal is to be able to build a module "text database" of all modules that are in the sys.path, by discovering all candidate modules (I've already done that), importing all of them, and then introspecting on each module to discover its functions, globals and classes. But for now I am having a problem with the latter. I would like to import a module and figure out the names of...
1
4877
by: aj | last post by:
What is the difference (if any) between inspect check database and db2dart ??? Do they both find the same potential problems? Does one provide more comprehensive checking than the other? TIA
4
1388
by: Chris Pax | last post by:
Hello, I recently been trying to use the inspect module to inspect the arguments of gtk objects, such as gtk.Button. I tried like this: inspect.getargspec(gtk.Button.__init__) and get the fallowing error: File "<stdin>", line 1, in <module>
0
890
by: Stef Mientki | last post by:
hello, I'm not familiar with inspect, but I get an error (see below) in getmembers ( wx ) Of course this is bug in wx . But would you also call this a bug in inspect ?
0
1652
by: Stef Mientki | last post by:
Gabriel Genellina wrote: REALLY GREAT ! But this is fully beyond my understanding: m = getmembers ( wx ) print m runs fine print getmembers ( wx )
0
2198
by: rajasankar | last post by:
Hi, I am using Jython based application and trying to use inspect.py in the python files. Here is my code import inspect,os,sys,pprint,imp def handle_stackframe_without_leak(getframe): frame = inspect.currentframe() try: function = inspect.getframeinfo(getframe)
0
9690
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...
0
10275
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
10253
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
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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
7576
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
6811
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();...
1
4149
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
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.