471,321 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to access "DefaultNamespace"

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)
Feb 7 '06 #1
5 1863
Right-click on the Project in Solution Explorer, and choose "Properties". The
default namespace should be visible on the third line.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ri*****@nospam.nospam" wrote:
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)

Feb 7 '06 #2
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
"Peter Bromberg [C# MVP]" wrote:
Right-click on the Project in Solution Explorer, and choose "Properties". The
default namespace should be visible on the third line.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


Feb 7 '06 #3
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


"Ri*****@nospam.nospam" wrote:
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
"Peter Bromberg [C# MVP]" wrote:
Right-click on the Project in Solution Explorer, and choose "Properties". The
default namespace should be visible on the third line.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

Feb 8 '06 #4
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

"Peter Bromberg [C# MVP]" wrote:
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


Feb 8 '06 #5
> 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
Feb 8 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

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.