Embedded Resource Help - Fully readable in text editor

Maaatt

Member
Joined
Sep 4, 2006
Messages
16
Programming Experience
Beginner
I'm having trouble with an embedded resource. The problem is that when compiled and opened in a text editor you can see in perfect untouched detail what was in the file. I'm trying to get the embedded resource to be "encrypted" perhaps.

Anybody have any solution? I simply dont want the content in the embedded resource file to be readable when the program is opened in a text editor.

I hope somebody knows what i mean :eek:
 
Last edited:
Hmm... I think i know what you mean, but i also dont. How would i go about doing that? (if you've got time)

If needed to know:
---------------------------------
I've got an application that on the click of the button can create an executable using the code in the frmCode.vb embedded resource file. When the button is clicked it creates the program, which when opened in a text editor is garbled because its been compiled, but its not the compiled program that's the problem, it's the program that compiles the code from the resource. It seems to show the embedded resource text file as plain text when opened in text editor, no garbledness which is what i'm after. This is the code in the button event.

VB.NET:
Dim asmAssembly As System.Reflection.Assembly = Me.GetType.Assembly.GetExecutingAssembly()
strName = asmAssembly.GetName().Name + ".frmCode.vb"
 
Dim fileStream As Stream = asmAssembly.GetManifestResourceStream(strName)
Dim objStreamReader As StreamReader = New StreamReader(fileStream)
Dim strSourceCode As String = objStreamReader.ReadToEnd()
objStreamReader.Close()
 
VB.BuildFile(strSourceCode, "frmCode", True, strProcessName, Info)
 
Last edited:
Excellent, i used your idea. I had to make a Code File .vb file with the encrypted string and do that assembly resource thing to get it then decrypt it.

It's not how i'd originally have liked to do it since if i make a change to the code i have to encrypt it again and again for everytime i do so, but hey, it works now and that's all i happen to care about ;)

Thanks mods/admins.

By the way; I created a thread in security since i thought thats where i shouldve been posting so if you'd like to remove that one and perhaps move this thread there instead incase somebody else comes along with the same help query i had :)
EDIT: Thanks :)
 
Last edited:
Back
Top