We help IT Professionals succeed at work.

Clean up ini file automatically

itnifl
itnifl asked
on
I have some manual code that cleans up a corrupt ini file, for instance removes duplicate sections and keys. I don't like using that custom code, would like to use a standard library instead. Have been looking at https://github.com/rickyah/ini-parser, but it seems to not have any automatic way of cleaning this up. If it encounters an invalid ini file with duplicate sections and keys, it throws an error.

Does anyone here know of a library out there that I can use in .Net C# that automatically fixes the problems described above?
Comment
Watch Question

Senior Developer
Commented:
There is no way to do this automatically. Cause the content of a ini-file and whether it is valid depends on the application. A tool cannot know this. Especially as there is not a real grammar for ini-files. Further more, duplicate sections or keys can be valid..
itniflProgrammer

Author

Commented:
Thank you. I found an acceptable solution with self-written code instead.