0

I have two C# executables, patcher.exe, and generator.exe.
Now patcher.exe has a .Net resource 'config.dat', and it's empty.

What I want is that generator.exe, can change (completely overwrite) the config.dat of the patcher. This is so that we can distribute patchers with different configuration to different people, without them actually knowing much about the internal processing, nor knowing how the config.dat is generated.

So how to dynamically change the .Net resource of patcher.exe from generator.exe?

Aidiakapi
  • 6,034
  • 4
  • 33
  • 62

1 Answers1

1

You sure editing the embedded resource at runtime is what you're after? As it would require a recompile.

As from the sounds of it you could achieve this configuration flexibility through the app.config by specifying the application domain you wish to use programmatically at runtime. This can be achieved by:

AppDomain.CurrentDomain.SetData("CONFIG_FILE", "C:\Path\To\File.config");

Or by creating custom configuration sections for users and have these included.

Finally you may also want to look into Satellite assemblies with the example on MSDN referring to an application with several different language translations. Here


Right apologies it seems I misunderstood what you were trying to achieve. If I understand correctly it looks like you want to achieve something along the lines of this post. More information on the method (admittedly the sample is not C# code) is on the MSDN, but this gives the logic. You can then use UpdateResource(....).

Community
  • 1
  • 1
tomahawk
  • 249
  • 2
  • 9
  • Yes, I'm very sure that's what I'm after. And I don't want to recompile the source, I want to edit the resource in the .exe file. Like finding the entry point, cutting out and pasting in the new data. If it makes it easier adding a native resource through the kernel. Also the names in the description are just for clarity, but it's not a config file at all. – Aidiakapi Feb 28 '11 at 13:54
  • Ok sure I better understand what you are trying to achieve now. I have updated my post above. – tomahawk Feb 28 '11 at 14:18
  • Okay, I'll take a look at it :) – Aidiakapi Feb 28 '11 at 15:08