forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for Manifest Resource Streams
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Manifest Resource Streams | ||
Manifest Resource Streams allow you to include data from the files as byte arrays in your code. An example of its use is in the [ZMachine Demo](https://github.com/CosmosOS/Cosmos/blob/5973a3fae95c989dc13505184aff9a15aae9f65f/Demos/ZMachine/ZKernel/Kernel.cs#L19) | ||
|
||
## Drawbacks | ||
Due to short comings in NASM there is a maximum size to the files which can be included this way. | ||
|
||
## How to use | ||
1. Set the file you want to use as embedded resource using the File Properties window in VS. | ||
![image](https://user-images.githubusercontent.com/8559822/132468001-256b92d1-0b29-4db3-9ef5-3383bfdef023.png) | ||
2. In the code reference the file using the following format: | ||
``` | ||
[ManifestResourceStream(ResourceName = “{project_name}.{filename_with_extension}”)] | ||
static byte[] file; | ||
``` | ||
The field _must_ be static. | ||
|
||
3. To access the data simply read from the byte array defined. |