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 not account for. 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, only the lines that are included in the saved differences including multiple ones
- replace in the INI file only the lines included in the difference files, 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)
- 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 (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.
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) or
- b) any item in the difference file is included more than 1 time in the INI file
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