473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

INI file library checking for duplicates, missing, backing then replace?

DynV
4
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 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:
  1. 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)
  2. save everything that is to be replaced, only the lines that are included in the saved differences including multiple ones
  3. 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)
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 (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
, 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
Mar 26 '22 #1
0 6805

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gilles Lenfant | last post by:
Hi, I'm totally newbie in the signature stuffs. I got a text file stuff.txt and a (said PKCS7) signature file sign.txt that looks like this... "3080020101310b300906052b0e03021a050030800..."...
2
by: Rich Bogle | last post by:
Does anyone have a good module or clean method for making sure file names do not have special charactes / illegal characters in them before attempting to save the file. I have a perl script that...
2
by: Hugh Macdonald | last post by:
I'm writing a tool at the moment that reads in an external file (which can use any Python syntax) At the moment, I'm reading the file in using: scriptLines = open(baseRippleScript).read()...
2
by: Chesne | last post by:
Can anyone help with some code which will enable me to enter the first cheque number and the last cheque number and to determine if there are any cheque missing from the sequence? Any help would...
2
by: bdog4 | last post by:
I've got a spell checking function in php that will check the words in a sentance and suggest corrections. Right now I have it to print out the words with 6 suggestions for each misspelled word. ...
1
by: gryffin | last post by:
im trying to do file extension checking but its not working :( i have the following in the head <script language="JavaScript"> extArray = new Array(".jpg", ".png", ".bmp"); function...
1
by: sang | last post by:
Hi, The below code is used to read the document file. But at output it will give the special characters and ascii values. So i want only the readable characters (ie a-z and 0-9) how is possible...
0
by: rsaikamesh | last post by:
Hi All, I am developing an application in c++. Now I am planning to create application configuration file(start up file) for my application. I dont know which is the best c++ configuration file...
0
by: Nicole P | last post by:
I am attempting to register an assembly on a server running Windows Server 2003. This dll was registered successfully on another server already using regasm.exe and cmdline (diff operating system). ...
2
by: meofcors | last post by:
i have a text file say "list.text" containing phrase that is words and spaces, each phrase is in a new line. I have a large number of text files in the form of paragraphs of size app 2mb each,i need...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.