Click here to Skip to main content
15,898,984 members
Home / Discussions / C#
   

C#

 
AnswerRe: Save an object to my exe? Pin
Dan Mos9-Mar-10 6:47
Dan Mos9-Mar-10 6:47 
AnswerRe: Save an object to my exe? Pin
Luc Pattyn9-Mar-10 7:09
sitebuilderLuc Pattyn9-Mar-10 7:09 
GeneralRe: Save an object to my exe? Pin
Som Shekhar9-Mar-10 7:26
Som Shekhar9-Mar-10 7:26 
GeneralRe: Save an object to my exe? Pin
Luc Pattyn9-Mar-10 9:42
sitebuilderLuc Pattyn9-Mar-10 9:42 
AnswerRe: Save an object to my exe? Pin
Dave Kreskowiak9-Mar-10 7:32
mveDave Kreskowiak9-Mar-10 7:32 
AnswerRe: Save an object to my exe? Pin
Matthew Klein9-Mar-10 7:44
Matthew Klein9-Mar-10 7:44 
AnswerRe: Save an object to my exe? Pin
#realJSOP9-Mar-10 8:40
professional#realJSOP9-Mar-10 8:40 
AnswerRe: Save an object to my exe? Pin
AspDotNetDev9-Mar-10 12:44
protectorAspDotNetDev9-Mar-10 12:44 
You have two options. I'll describe them in different posts so you don't get confused. This first post will be for the simpler option.

First, add a resource (say, a string) to your application like your normall would, at design time. Only, make sure the resource is as large as the largest list you expect to embed in the EXE. Make sure the beginning and end of the string has unique data that is not likely to appear randomly in the rest of the EXE. When you compile it, open the EXE in a hex editor and find the unique parts of the string. Make note of the beginning and end of the string in the EXE.

Modify the string in the EXE (using the hex editor) so that the first part of the string that is not being used up by the unique string at the beginning of the string contains a number: the index into the EXE the string is embedded. That way, at runtime, you can parse the string and find out where it is located in the EXE. You can then have the EXE copy itself to a new file and have it modify the new EXE to contain the new data in the string resource (after the number that indicates the byte position of the string in the EXE). You then have the old EXE run the new EXE and close itself... the new EXE will then presumably clean up the old EXE by deleting it. If you want, the new EXE could then copy itself to where the old EXE used to be and then run the newer EXE, which will then delete the new EXE. You can use a counter parameter to keep track of how many EXE's you are into the process.

Also, since the resource string is a constant length, but the data it contains is variable length, you'll either want to delimit the end of the actual resource data, or create another number in the beginning of the resource string that indicates the length of the data.
AnswerRe: Save an object to my exe? Pin
AspDotNetDev9-Mar-10 12:57
protectorAspDotNetDev9-Mar-10 12:57 
GeneralRe: Save an object to my exe? Pin
Matthew Klein9-Mar-10 13:23
Matthew Klein9-Mar-10 13:23 
QuestionComparing things with null - but not for equality Pin
harold aptroot9-Mar-10 5:05
harold aptroot9-Mar-10 5:05 
AnswerRe: Comparing things with null - but not for equality Pin
Dan Mos9-Mar-10 5:33
Dan Mos9-Mar-10 5:33 
QuestionCode is Rounding Down instead of Rounding Up Pin
suprsnipes9-Mar-10 4:15
suprsnipes9-Mar-10 4:15 
GeneralRe: Code is Rounding Down instead of Rounding Up Pin
harold aptroot9-Mar-10 4:20
harold aptroot9-Mar-10 4:20 
AnswerRe: Code is Rounding Down instead of Rounding Up Pin
Richard MacCutchan9-Mar-10 4:42
mveRichard MacCutchan9-Mar-10 4:42 
AnswerRe: Code is Rounding Down instead of Rounding Up Pin
PIEBALDconsult9-Mar-10 4:44
mvePIEBALDconsult9-Mar-10 4:44 
AnswerRe: Code is Rounding Down instead of Rounding Up Pin
Luc Pattyn9-Mar-10 4:46
sitebuilderLuc Pattyn9-Mar-10 4:46 
GeneralRe: Code is Rounding Down instead of Rounding Up Pin
Richard MacCutchan9-Mar-10 6:19
mveRichard MacCutchan9-Mar-10 6:19 
GeneralRe: Code is Rounding Down instead of Rounding Up Pin
Luc Pattyn9-Mar-10 6:37
sitebuilderLuc Pattyn9-Mar-10 6:37 
GeneralRe: Code is Rounding Down instead of Rounding Up Pin
Richard MacCutchan9-Mar-10 7:38
mveRichard MacCutchan9-Mar-10 7:38 
GeneralRe: Code is Rounding Down instead of Rounding Up Pin
Luc Pattyn9-Mar-10 9:41
sitebuilderLuc Pattyn9-Mar-10 9:41 
AnswerRe: Code is Rounding Down instead of Rounding Up Pin
Rob Philpott9-Mar-10 6:10
Rob Philpott9-Mar-10 6:10 
AnswerRe: Code is Rounding Down instead of Rounding Up Pin
suprsnipes9-Mar-10 21:41
suprsnipes9-Mar-10 21:41 
QuestionPasspoint: Robust Discretization Pin
einsteinmow9-Mar-10 3:17
einsteinmow9-Mar-10 3:17 
AnswerRe: Passpoint: Robust Discretization Pin
R. Giskard Reventlov9-Mar-10 4:08
R. Giskard Reventlov9-Mar-10 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.