Originally Posted by
Hassan
The only way that I can see it happening is recompiling the application itself by passing the .resources [.resx] file you create at runtime and then pass this file to the EmbeddedResource parameter of your CodeDomProvider instance. To do this, you'll need to:
1: Create a new instance of CodeDomProvider (C# Code Provider).
2: Create a new instance of ResourceWriter which is a part of System.Resources namespace. You will need to give it a filename so it knows where to store the resource.
3: Write your new resource by using the AddResource method of the ResourceWriter instance. E.g: ResourceWriter.AddResource("Password","MyPassword" )
4: Add the newly generated resource file to the Embedded Resources of CodeDomProvider by using: CodeDomProvider.EmbeddedParameters.Add("PathToNewR esourceFile")
5: Compile the code to generate a new assembly. (To get rid of the current assembly, you might want to add some code to CodeDomProvider's entry point to delete the current assembly).
I know this is pretty complex but you can't modify existing embedded resource file when the executable is open. I think that there might be some other way to store the data but I can't think of any of it right now.