# General Discussion > General Developer Topics >  INI file library checking for duplicates, missing, backing then replace?

## DynV

I have--limited--programming experience with C, C++, C# & Java but am not limiting myself to those, I'm more interested in finding something that has a good library to work with INI files or text files. The main program uses a relatively large .ini file, that is used for its settings, which I'm looking to modify from time-to-time, therefore performance is not an issue at all; it would be nice if INI modification would be completed within 1 min on average or if it would be longer on average that there was progress bar, but if not it's ok.

So I've set the main program at 2 different configuration I'm interested in switching between occasionally; I've compared both configuration back-to-back, then cropped everything that remained the same (between the back-to-back configurations) then saved the difference in 2 different files with a name that reflect which version it is. The main program was not running during that time, only its launcher that has the option to do limited settings modification (more is available by either directly editing the .ini file or using an external (non-main) program). The main program may add or remove lines to the INI file during its use, which what I'm looking for should only account for the lines in the difference files that were removed (from the INI), in which case will be added to the INI. I'm only interested in the specific INI lines that are included in the saved differences (of the back-to-back configuration change).

So I'd like to do a program that do the following chronologically:
check if the INI file miss any of the saved difference, and if so include a special token during the backup (ie: some_setting=this_program_name_status_missing)save everything that is to be replaced and cropped (duplicates, explained in next step), only the lines that are included in the saved differences including multiple onesreplace in the INI file only the lines included in the difference files, if a line was missing add it to the INI, and if one had a duplicate only replace its 1st then remove the corresponding duplicates (since the duplicate removal may introduce an issue, it's important that the previous step be done correctly)
An example of this program actions: At the time of wanting to apply either of the 2 difference file,
INI contains for lines that aren't a group or comment a=1, b=2, c=3 & d=4,the difference file contains the lines b=8, c=6 & e=5 (contains no group nor comment),the backup will have the timestamp in its name and have for lines b=2 & c=3,finally the INI will keep its groups, comments and lines a=1 & d=4 as they were but make a replacement such as the line b will become 8 and the line c become 6, as well as adding the line e=5.

Only once everything else works as intended, I'd like this program to report if either
a) the INI file miss any of the items in the difference file (what's before '=' in its lines) orb) any item in the difference file is included more than 1 time in the INI file
, possibly using Event Viewer (Start Menu > Windows Administrative Tools > Event Viewer).

Hopefully my explanation made at least a bit of sense, but if you'd like clarification I'd appreciate if it was about a specific part or mention which parts you understood.

Thank you kindly for your help

----------


## 2kaud

[requested changes made]

----------

