LostPhysx
LostPhysx

Reputation: 3641

How to save a resource from .resx to hard drive?

I have a Windows Forms project with the standard main.resx file where a .ecfg file is saved (configuration file).

How can I extract this file to the hard drive?

Upvotes: 1

Views: 332

Answers (1)

John Koerner
John Koerner

Reputation: 38077

Check the namespace on your resource file. Usually they are put into the Properties namesapce. You can then access the file like this:

byte[] b = Properties.Main.Something;    //Something being the name of the resource
System.IO.File.WriteAllBytes(@"C:\temp\yourfile.ecfg", b);

Upvotes: 2

Related Questions