471,603 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to add binary data to executable ?

I need to add binary data to C# executable and then read it back
during execution or from another application.

In Delphi for Win32 I used the following:
- created binary Win32 resource with needed data;
- linked this resource with executable through {$RESOURCE <filename>}
directive;
- during execution I used TResourceStream to read binary data;
- from another application I used
LoadLibraryEx/EnumResourceNames/FindResource/
LoadResource/LockResource to read the same binary data.

How to implement the same functionality from C# ?

Oleg Subachev
Feb 1 '06 #1
2 2539
Oleg Subachev wrote:
I need to add binary data to C# executable and then read it back
during execution or from another application.

In Delphi for Win32 I used the following:
- created binary Win32 resource with needed data;
- linked this resource with executable through {$RESOURCE <filename>}
directive;
- during execution I used TResourceStream to read binary data;
- from another application I used
LoadLibraryEx/EnumResourceNames/FindResource/
LoadResource/LockResource to read the same binary data.

How to implement the same functionality from C# ?


Add it as an embedded resource in your project (assuming you're using
Visual Studio) and then use Assembly.GetManifestResourceStream.

Jon

Feb 1 '06 #2
> Add it as an embedded resource in your project (assuming you're using
Visual Studio) and then use Assembly.GetManifestResourceStream.


Thanks.

Then ResourceReader( GetManifestResourceStream ) allows read
name=value pairs containing in the resource.

Oleg Subachev
Feb 1 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

103 posts views Thread by Steven T. Hatton | last post: by
22 posts views Thread by Sunner Sun | last post: by
29 posts views Thread by tele-commuter | last post: by
8 posts views Thread by dagecko | last post: by
15 posts views Thread by JoeC | last post: by
16 posts views Thread by Erwin Moller | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

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.