rickyah / ini-parser

Read/Write an INI file the easy way!
MIT License
960 stars 236 forks source link

The problem of creating extra space #219

Open sami-soft opened 4 years ago

sami-soft commented 4 years ago

There is a problem with saving if the contents of the file we are reading are as follows :

[Identification] NOM=1234 PRENOM=12

when editing and saving , it puts an empty space in the file before and after equal :

[Identification] NOM = 1234 PRENOM = 12

How to remove this space? To output the same as the first file?

Mateo2197 commented 3 years ago

Download the source code and include it in your project. Then go to IniFileParser\Model\Configuration\IniParserConfiguration.cs open it in vs and edit AssigmentSpacer = " "; to AssigmentSpacer = "";

thiagoaxll commented 3 years ago

You can configure it when loading your .INI file. var parser = new FileIniDataParser(); IniData configData = parser.ReadFile(path); configData.Configuration.AssigmentSpacer = "";

WFDexter commented 2 years ago

Glad there's a way around it but it would be nice if the default were for the library to maintain whatever it found in the file. I just lost 2 days to figuring out that I was essentially "corrupting" an INI file that is read by a space-intolerant tool.

Is there any comprehensive documentation of properties and so forth?