Config file to turn on/off features ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a project where I need to be able to turn on/off some
features based on whether the user has purchased a particular feature. And,
the current UI has a tab control which I need to hide (or remove) tabs based
on this as well. My original plan was to use an XML config file and use that
to determine whether a user gets to see a feature (or a tab page) and then
remove or hide as necessary.

If anyone has done something like this before and has any other ideas or
suggestions, it would be appreciated.

Thanks
- dw
 
You could use the application configuration file to switch this off and on,
but you need to ask whether or not you need to lock this down. You don't
want your users enabling features by editing the file in notepad.
You could encrypt which features are enabled or disabled as part of an item
in this configuration file using cryptography. There is a good introductory
article in C# corner about this -
http://www.dotnet247.com/247referen...rpcorner.com/Code/2002/May/FileEncryption.asp.
 
I am working on a project where I need to be able to turn on/off some
features based on whether the user has purchased a particular feature.
And, the current UI has a tab control which I need to hide (or
remove) tabs based on this as well. My original plan was to use an
XML config file and use that to determine whether a user gets to see a
feature (or a tab page) and then remove or hide as necessary.

I've used that technique several times in the past... works fine. Other
places you could store configuration are in the registry or a database.
The determination of which one to use should be made by your particular
requirements... XML files for configuration are easy for users to edit,
and don't make unnecessary alterations to the system, but may also allow
the user to corrupt the config file. Registry is a bit harder for users to
get into (they need to know about "the registry" to start with, and they
need to know where you are storing your data) but "require" special
routines to remove the values when the program is removed. Database can
make it very difficult for users to change values outside your program but
require either additional programs to run (MSDE or mySQL for example) or
require some kind of network connection.

Bottom line: XML for config files works great and is easy to use and clean
up, but can cause problems if you have curious (and careless) users.

-mdb
 
Thanks...I'll check out the article. Yes, you are right, I would definitely
encrypt the key/value pairs to prevent tampering.
 
Thanks for the advice.

This is a PocketPC based app and there will be a database (SQL CE)....so
storing there might prove the best solution.

- dw
 
Back
Top