I'm writing a WinForms desktop application which will be shipped out to several different clients and am wondering what the best way to implement a user configuration file is. Normally I would use the built in Settings.settings
or app.config
to store user settings but in this case what I want to store is unique for every client, I want it to be configured before sending it out and I want to avoid recompiling every time we ship to a new client.
What I want my config file to do is to store some information about the client specific graphics used in the program and some (hashed) passwords.
We don't suspect that the users would be hacking into anything in the program; we're just trying to avoid regular 'tech' level users from making changes or accessing certain modules that a manager should change. Up until now the password has been hardcoded and over a few years of use everyone has gotten to know what it is. We'd like to be in more control of what passwords go where but not necessarily give the clients control of the password changes.
I wrote a separate program that (de)serializes a configuration class to an XML file that would be put in the appropriate directory upon installation so that all people need to do (after I'm out of the picture) is have the .msi
of the program, create an xml config file using this separate program, include the graphics they want in a sub folder and zip it all up. Then when the user unzips and installs, everything is put in the right place. When my program loads it looks for my config file to finish loading. If it can't find it it gives the user a change to locate it otherwise the program doesn't open.
I've been reading about the ConfigurationManager
class but can't figure out how I could best use it. I haven't found much on people using outside configuration files and am not sure if my situation truly is unique or I'm not thinking inside the box enough. Is this a good design? Should I be doing this differently? If you have had a similar situation how have you solved it?