Skip to content

How Can i Add a Specific File in My OS #2785

Answered by 9xbt
ahmedbarakat2007 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, so in the VS solution explorer right click the file you wanna embed and click properties. Then select Embedded Resource in the drop down box. Then add this to your using directive

using IL2CPU.API.Attribs;

Then add this inside your kernel class (or wherever you want to have the variable for using it)

[ManifestResourceStream(ResourceName =Namespace.Folder.Filename.extension)]
static readonly byte[] rawFileData;

If for example you add a text file you would do this to get it in a string

static readonly string fileData = new string(rawFileData);

And thats about it. Note that this code is pseudocode and its not tested but it should work if you change the necessary stuff

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by ahmedbarakat2007
Comment options

You must be logged in to vote
1 reply
@9xbt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants