Hi
At work, we have a lot of small applications that I like to call software glue. These are applications that basically take data or inputs from one system, massage the data and send it to other systems/applications.
Most of these applications were written in the old VB6 language.
Last week, I started to migrate one of the applications written in VB6 and then in VB.Net using .Net framework 1.1 to Visual Studio 2010 in VB.Net using .Net Framework 3.5.
One of the first bottlenecks I came up against are application and user settings.
Application settings, by default are read-only in the new scheme of things. It seems like we have to go through a few hoops to change application settings from within the executing application. In addition, there are very few samples online in VB.Net. Almost everyone seems to be programming in C#. msdn has not been of great help.
User settings are modifiable by end-users. I need to store a very simple set of configuration. But the numbers are dynamic. For example, I want to store a list of attendance readers and their IP addresses. My INI looks like this
[Main]
NoOfReaders=2
ReaderIP1=xxx.xx.xx.xx
ReaderPort1=xxxx
ReaderIP2=xxx.xxx.xxx.xxx
ReaderPort2=xxxx
The application is not restricted to any number of readers. It runs as a service and reads configuration files on service startup. Any time I want to add a reader or remove one, I remove the appropriate entry from the INI and reduce the NoOfReaders counter. I know there're are other ways, but this suits me best.
Anyway, all this was very complicated for our new application to store as application/user . settings. The old applications used the simpler :-) INI format.
Re-writing all the INI management modules from the old software seemed like a lot of work that would take my time away from updating the core functionality of the software.
After a little digging around, I found this excellent library http://nini.sourceforge.net
Look it up. Solves all troubles with application settings, allows me to easily migrate the INI files from the older application to the new ones.
Once my new application is running fine, I can move over "legacy" INI file to the new app.config way of doing things.
Look up nini. Looks excellent.
Best
No comments:
Post a Comment