473,322 Members | 1,699 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,322 software developers and data experts.

Compiling in GIFs etc.

Currently I'm using Image.FromFile() to load files at run-time, but I don't
want to include editable gifs and such in a release. I've checked the
manual, but all I can find under "resource files" and such are xml and text.
Is there anyway I can bundle all of my external files (gifs, wavs, etc.)
into a single file, that can't so easily be messed with by an "experienced"
user ;)

--
Daisy The Cow
Now playing: Flip & Fill - I Wanna Dance With Somebody [Flip & Fill Mix]
Nov 15 '05 #1
8 3590
Add them to your project, set their "build action" to "Embedded
Resource". You can use them via streams against the
"GetManifestResourceStream()". This code-snipped from one of my apps
should get you started.

adbi is the name of my assembly
trans_file.txt is the name of the file I embedded as a resource

the entire spec together adbi.trans_file.txt (assembly.resource_name)
is how you identify a unique resource in an assembly.

try{
Assembly thisAsm = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.StreamReader input = new System.IO.StreamReader(
thisAsm.GetManifestResourceStream( "adbi.trans_file.txt" ) );
this.lblTransactFile.Text = input.ReadToEnd();
input.Close();
} catch(Exception ex) {}

"Daisy" <da***@nospam.oops> wrote in message news:<bf**********@linux01.dannytuppeny.com>...
Currently I'm using Image.FromFile() to load files at run-time, but I don't
want to include editable gifs and such in a release. I've checked the
manual, but all I can find under "resource files" and such are xml and text.
Is there anyway I can bundle all of my external files (gifs, wavs, etc.)
into a single file, that can't so easily be messed with by an "experienced"
user ;)

Nov 15 '05 #2
"Chris Hornberger" <ch***@chornbe.com> wrote in message
news:53**************************@posting.google.c om...
Currently I'm using Image.FromFile() to load files at run-time, but I don't want to include editable gifs and such in a release. I've checked the
manual, but all I can find under "resource files" and such are xml and text. Is there anyway I can bundle all of my external files (gifs, wavs, etc.)
into a single file, that can't so easily be messed with by an "experienced" user ;)


Add them to your project, set their "build action" to "Embedded
Resource". You can use them via streams against the
"GetManifestResourceStream()". This code-snipped from one of my apps
should get you started.

<snip>

Thanks, but I'm not using Visual Studio... I'm, er, using a text editor!!
(even for my forms!)...
As well as not really liking it, I'm not paying the price for small hobby
projects..

I don't supposed you know how to include them from a command line?
--
Daisy The Cow
Now playing: Dannii Minogue - I Begin To Wonder [Extended Mix]
Nov 15 '05 #3
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
PMFJI, I realize this is not what you asked.

Have you tried Sharp Develop? <snip>

Yep!
I wasn't too fond of the code it generated with forms, so I decided to try
doing it myself, and it's dead easy, so I've stuck with it since :o)
The C# compile options are listed at:
http://msdn.microsoft.com/library/de...abetically.asp
Possible the linkresource or resource option is what you want?


Cheers, but I'd already looked at them, but the docs seemed to suggest
they'd only do xml & txt files
:o(
--
Daisy The Cow
Now playing: Madonna - Frozen
Nov 15 '05 #4
Daisy,
Yep!
I wasn't too fond of the code it generated with forms, so I decided to try
doing it myself, and it's dead easy, so I've stuck with it since :o)
You can use Sharp Develop to edit your source and manage your projects
without using their forms designer!
Cheers, but I'd already looked at them, but the docs seemed to suggest
they'd only do xml & txt files
:o( Did you look at the page, or did you try to use them to embed a gif?

The '/resource' option states "To set this option in VS.NET ... set build
action to Embedded Resource".

Well if I can add a GIF to my VS.NET project, set the build action to
Embedded Resource, and it gets included in the executable, that would
suggest to me that on would be able to use /resource:your.gif on csc, and
the gif would be embedded.

If you really would like me to take the time to try it for you, rather than
you just trying it yourself. I will. :-|

Hope this helps
Jay

"Daisy" <da***@nospam.oops> wrote in message
news:bf**********@linux01.dannytuppeny.com... "Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:uk**************@TK2MSFTNGP12.phx.gbl...
PMFJI, I realize this is not what you asked.

Have you tried Sharp Develop?

<snip>

Yep!
I wasn't too fond of the code it generated with forms, so I decided to try
doing it myself, and it's dead easy, so I've stuck with it since :o)
The C# compile options are listed at:

http://msdn.microsoft.com/library/de...abetically.asp

Possible the linkresource or resource option is what you want?


Cheers, but I'd already looked at them, but the docs seemed to suggest
they'd only do xml & txt files
:o(
--
Daisy The Cow
Now playing: Madonna - Frozen

Nov 15 '05 #5
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:eo**************@tk2msftngp13.phx.gbl...
Yep!
I wasn't too fond of the code it generated with forms, so I decided to try doing it myself, and it's dead easy, so I've stuck with it since :o)
You can use Sharp Develop to edit your source and manage your projects
without using their forms designer!


hehe, so I can... :P
I'm used to UltraEdit from my ASP coding, so I was just a bit biased, and
I've gotten used to writing C# in it now... I found some weird bugs in C#,
my scrollwheel used to scroll panes around the code window, and never the
code window, regardless of where focus was... kinda got annoyed and binned
it off ;)

Cheers, but I'd already looked at them, but the docs seemed to suggest
they'd only do xml & txt files
:o(

Did you look at the page, or did you try to use them to embed a gif?

The '/resource' option states "To set this option in VS.NET ... set build
action to Embedded Resource".


I wanted to include files in a seperate file, not the exe, so I followed a
link about resource files generated with resgen.exe, where I read "The
Resource File Generator converts .txt files and .resx (XML-based resource
format) files to common language runtime binary". That's why I decided to
post here assuming it was dead easy and someone would post a few lines of
code :)

Well if I can add a GIF to my VS.NET project, set the build action to
Embedded Resource, and it gets included in the executable, that would
suggest to me that on would be able to use /resource:your.gif on csc, and
the gif would be embedded.

If you really would like me to take the time to try it for you, rather than you just trying it yourself. I will. :-|


It's not that I'm too lazy to try it, but the way you've shown would embed
in the exe? and the other way I've read only seems to do txt & xml :-\
--
Daisy The Cow
Now playing: Divine Inspiration - The Way [N-Trance Mix]
Nov 15 '05 #6
Daisy,
Going back to your original question: ;-)
Is there anyway I can bundle all of my external files (gifs, wavs, etc.)
into a single file, that can't so easily be messed with by an "experienced" user ;) .... long discussion snipped ... It's not that I'm too lazy to try it, but the way you've shown would embed
in the exe? and the other way I've read only seems to do txt & xml :-\
-- What kind of 'external file' would you like it included in?

1. You can include them in the exe itself, which was what I thought you
wanted.
2. You can include them in one of your DLL, which is about the same as
above.
3. You can include them in a .resource file, which can have locking issues
4. You can include them in a resource/satellite DLL, unlike #2 this dll does
not contain code.
5. You can include them in a .resx file, which you can either use, or create
a .resource file from.
6. You can include them in a .zip file, password protected to avoid 'easily
be messed with'.
7. ...

Generally I include my 'resources (gifs, wavs)' as embedded resources in my
executable.

The txt & resx file are input into a .resource file, the .resource file can
be input into a DLL or EXE. You can also directly embed the gif into the
exe.

For further details see:
http://msdn.microsoft.com/library/de...mework_sdk.asp

Hope this helps
Jay
"Daisy" <da***@nospam.oops> wrote in message
news:bf**********@linux01.dannytuppeny.com... "Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:eo**************@tk2msftngp13.phx.gbl...
Yep!
I wasn't too fond of the code it generated with forms, so I decided to try doing it myself, and it's dead easy, so I've stuck with it since :o)


You can use Sharp Develop to edit your source and manage your projects
without using their forms designer!


hehe, so I can... :P
I'm used to UltraEdit from my ASP coding, so I was just a bit biased, and
I've gotten used to writing C# in it now... I found some weird bugs in C#,
my scrollwheel used to scroll panes around the code window, and never the
code window, regardless of where focus was... kinda got annoyed and binned
it off ;)

Cheers, but I'd already looked at them, but the docs seemed to suggest
they'd only do xml & txt files
:o(

Did you look at the page, or did you try to use them to embed a gif?

The '/resource' option states "To set this option in VS.NET ... set build action to Embedded Resource".


I wanted to include files in a seperate file, not the exe, so I followed a
link about resource files generated with resgen.exe, where I read "The
Resource File Generator converts .txt files and .resx (XML-based resource
format) files to common language runtime binary". That's why I decided to
post here assuming it was dead easy and someone would post a few lines of
code :)

Well if I can add a GIF to my VS.NET project, set the build action to
Embedded Resource, and it gets included in the executable, that would
suggest to me that on would be able to use /resource:your.gif on csc, and the gif would be embedded.

If you really would like me to take the time to try it for you, rather

than
you just trying it yourself. I will. :-|


It's not that I'm too lazy to try it, but the way you've shown would embed
in the exe? and the other way I've read only seems to do txt & xml :-\
--
Daisy The Cow
Now playing: Divine Inspiration - The Way [N-Trance Mix]

Nov 15 '05 #7
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Going back to your original question: ;-)
;-P
What kind of 'external file' would you like it included in?

<snip>

I didn't want to bloat the exe with lots of toolbar buttons etc. but also
didn't really want the user to think they knew what they were doing and
"customise" my app ;o)
Any external file would do, I didn't think about putting them into a dll,
that might do the job :o)
If not, I'll just have to go bloaty and stick them in the exe... This does
have the side-effect of being able to run from a single file :-))

I'll have a look through the link you posted when I get back from work too.
Thanks Jay :o)
--
Daisy The Cow
Now playing: Nothing
Nov 15 '05 #8
Oh, no problem. Have your resources (icons, bitmaps, etc) in their
respective file formats and simply add them on the command-line with
the /resource: parameter.

Complete info is available by running the compiler with the /?
parameter

"Daisy" <da***@nospam.oops> wrote in message news:<bf**********@linux01.dannytuppeny.com>...

Thanks, but I'm not using Visual Studio... I'm, er, using a text editor!!
(even for my forms!)...
As well as not really liking it, I'm not paying the price for small hobby
projects..

I don't supposed you know how to include them from a command line?

Nov 15 '05 #9

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

Similar topics

0
by: jerrygarciuh | last post by:
Hello everyone, Wondering if anyone else has had problems with gifs created by php or if anyone sees a problem with this code. Symptom: created jpegs work fine and created gifs work fine in...
3
by: jerrygarciuh | last post by:
Hello everyone, Wondering if anyone else has had problems with gifs created by php or if anyone sees a problem with this code. Symptom: created jpegs work fine and created gifs work fine...
4
by: tnhoe | last post by:
Hi, how do i code such that all gifs are loaded without missing any one of them ? I always get missing few gifs when the page loading with 30 gifs. I use IE6 to browse many <a...
0
by: GrandpaB | last post by:
I am creating a small simulation in VB and wish to incorporate several animated GIFS. I can load the GIFS from the hard drive into a picture box and they animate, but I have two questions. 1.)...
2
by: Scirious | last post by:
People, I need a way to detect the moment an animated GIF gets to it's end to switch to a different GIF. I can't use a Timer because the GIFs have different times and doing so (as I'm doing at the...
7
by: Scirious | last post by:
People, I have to different animated gifs. How do I make them only one gif? TIA, Scirious.
3
by: ZikO | last post by:
Hi. I am making a Multimedia Presentation in VB.NET 2005 and I have some animated GIFs which I need to use. I tried to use PictureBox for it but it doesn't play an animation in GIFs :/. What I...
4
by: Jeff | last post by:
Hi, I'd like to write Javascript that stops animated gifs from animating. On Firefox, at least, window.stop(); does the trick, although it stops everything on the page and is kind of...
0
by: helraizer1 | last post by:
Hey, I have a PHP script that I made for an image based shoutbox with emoticons. The problem is that php GD doesn't support animated gifs, yet perl GD does. How would I make it so that I could...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
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.