How to add binary data to executable ?

  • Thread starter Thread starter Oleg Subachev
  • Start date Start date
O

Oleg Subachev

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
 
Oleg said:
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
 
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
 
Back
Top