my application uses the standard app.config to store the public configuration data. However, there are still some other data which are not public, but they still must be accessible all the time, persistent, changeable from out of the application as well as manually in case of some problems.
For example imagine that the application stores some licensing information within a file which must not be public available. However, an administrator must be able to edit this file using notepad or similar (without any special editors), so cryptography is out of the game.
Would you use isolated storage? Do you have some other suggestions? Since the application is not using any database, please do not consider storing withing a DB as an option, too.
So the question is how to store application data so that it is not a开发者_开发技巧s easy to modify by hand as with app.config, but still easily editable for a power user.
What about an include file?
Like the file attribute in the appSettings Element or the SectionInformation.ConfigSource Property?
<configuration>
<appSettings file="machine-specific.config">
<add key="Application Name" value="MyApplication" />
</appSettings>
</configuration>
The included file can be protected from public access with regular filesystem access rights.
I would definitely NOT use isolated storage for that. Encryption would be ideal but since that is not acceptable for you...
Using environmental variables would work too I guess... But I would probably not use it myself.
I've had very good results Using Settings in C#.
You can easily manage application and user settings, which will be automatically stored in isolated storage by the class that Visual Studio generates. They support pretty much any type that is serializable in XML while still being strongly typed.
精彩评论