How to access "DefaultNamespace"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I added a bitmap file to my project in the Soultion Explorer window. I set
the Build Action property on the bitmap file to Embedded Resource. The
Project Properties, File Properties help item says "The identifier will be
namespace.filename.extension, where namespace is the value of the
DefaultNamespace property in a Visual C# project". So, how do I access
DefaultNamespace?

Thanks in advance,
Richard Wilder
(C# noob)
 
Right-click on the Project in Solution Explorer, and choose "Properties". The
default namespace should be visible on the third line.
Peter
 
Thanks Peter,
I want to pass that to TextureLoader.FromFile as the FileName parameter but
FileName is supposed to be a string. If I try
"TextureTutorial.SpinButtonl.bmp" as the parameter I get a runtime exception
if I just try TextureTutorial.SpinButtonl.bmp (sans quotes) I get a compile
error that says SpinButtonl does not exist in TextureTutorial... I'm just
trying to load a bitmap that happens to be a resource into my texture so I
don't have to keep a bunch of bmps around when I deploy. Any idea how that's
done?

Thanks,
Richard Wilder
 
Not exactly sure what you need, but if you just want to add the bitmap files
to your project and in their properties set them as "embedded resource" you
can get them out of the assembly easily with GetManifestResourceStream method
of the Assembly class.
You can use GetManifestResourceNames to return a string array of their exact
names if you need it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
Thanks again for writing Peter.
OK, I got the name of the bitmap & it's "TextureTutorial.SpinButtonl.bmp".
Now I just need to load that bitmap into a texture. If it (SpinButtonl.bmp)
were a disk file I could just use myTexture =
TextureLoader.FromFile(myDevice, "SpinButtonl.bmp",...) to get the bitmap
into the texture. Is there a way to get the bitmap that's stored as a
resource into a texture?

Thanks,
Richard Wilder
 
OK, I got the name of the bitmap & it's "TextureTutorial.SpinButtonl.bmp".
Now I just need to load that bitmap into a texture. If it
(SpinButtonl.bmp)
were a disk file I could just use myTexture =
TextureLoader.FromFile(myDevice, "SpinButtonl.bmp",...) to get the bitmap
into the texture. Is there a way to get the bitmap that's stored as a
resource into a texture?

Wouldn't this do ??

Assembly a = Assembly.GetAssembly(this.GetType());
Stream stream = a.GetManifestResourceStream(someResourceName);
TextureLoader.FromStream(myDevice, stream ,...)

Soren
 
Back
Top