Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Allow supression of empty lines before Section #121

Open
glatzert opened this issue Nov 25, 2016 · 5 comments
Open

Proposal: Allow supression of empty lines before Section #121

glatzert opened this issue Nov 25, 2016 · 5 comments
Assignees
Milestone

Comments

@glatzert
Copy link

Allow the programmer to set something like "NewLineBeforeNextSection" in the Parser.Configuration.
Some INI Readers don't like the empty lines there

@rickyah
Copy link
Owner

rickyah commented Dec 5, 2016

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?

@glatzert
Copy link
Author

glatzert commented Dec 6, 2016

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.

@rickyah rickyah self-assigned this Dec 31, 2016
@rickyah rickyah added this to the v3.0.0 milestone Feb 17, 2017
@rickyah
Copy link
Owner

rickyah commented Feb 17, 2017

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

@glatzert
Copy link
Author

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 :))

@csnewman
Copy link

It would also be nice to be able to disable the new line before comments on key-value pairs as well.

if (keyData.Comments.Count > 0) sb.Append(format.NewLineStr);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants