Open glatzert opened 7 years ago
I don't really understand the issue. You mean that blank lines before a section confuses an INI reader? Which reader, do you have an example?
I have a Blackbox-Software which will accept an INI file in a specific location. Whatever that parser inside the (proprietary) software is - it will stop processing files upon the first empty line. Yes, I know that parser sucks, no I cannot do anything about it.
But if I just load and write a file without modifications, the ini-parser (yours), which does a pretty good job, will not result in the same file, since \r\n will be added before Sections (or probably at the end of sections). So I use a MemoryStream to write the Ini-Data, write that to an string, make replace operations in the string (\r\n\r\n --> \r\n) and finally write the string to the hdd. And thus I proposed a setting.
I'm planning a rewrite of the parser so it is easy to tackle this kind of things, and more (comments in the same line) but it will take a little bit of time
Nice 👍 If you are up-for-grabs, I'd possibly able to spare some time into the Parser as well (since it is a valuable tool for me, that'd be more than fair :))
It would also be nice to be able to disable the new line before comments on key-value pairs as well. https://github.com/rickyah/ini-parser/blob/260b764ea7ed0039eadb90d383e40b76287bb0ea/src/IniFileParser/Model/Formatting/IniDataFormatter.cs#L63
Allow the programmer to set something like "NewLineBeforeNextSection" in the Parser.Configuration. Some INI Readers don't like the empty lines there