How to include spaces between equal sign when working with ini files c#? -


hi have ini file that's formatted this

[text] abcd = 1234 text = 1002 = 4414 last = 1824 

however when use inifile class, class found online dealing ini files:

using system.io; using system.reflection; using system.runtime.interopservices; using system.text;  // change match program's normal namespace namespace program {     class inifile   // revision 10     {         string path;         string exe = assembly.getexecutingassembly().getname().name;          [dllimport("kernel32")]         static extern long writeprivateprofilestring(string section, string key, string value, string filepath);          [dllimport("kernel32")]         static extern int getprivateprofilestring(string section, string key, string default, stringbuilder retval, int size, string filepath);          public inifile(string inipath = null)         {             path = new fileinfo(inipath ?? exe + ".ini").fullname.tostring();         }          public string read(string key, string section = null)         {             var retval = new stringbuilder(255);             getprivateprofilestring(section ?? exe, key, "", retval, 255, path);             return retval.tostring();         }          public void write(string key, string value, string section = null)         {             writeprivateprofilestring(section ?? exe, key, value, path);         }          public void deletekey(string key, string section = null)         {             write(key, null, section ?? exe);         }          public void deletesection(string section = null)         {             write(null, null, section ?? exe);         }          public bool keyexists(string key, string section = null)         {             return read(key, section).length > 0;         }     } } 

it able add ini file in format such:

test=0010 

the read function not work except on ones write function created.

how able change code places spaces before , after equal sign? adding space before value works having 1 after key not. i'm hesitant add spaces in value because i'm afraid might alter actual value , make in in readable operation i'm using for.

any insight appreciated, thanks.

here inifile class enable achieve spacing: https://github.com/marioz/madmilkman.ini

what need provide inioptions required formatting, this:

inioptions options = new inioptions(); options.keyspacearounddelimiter = true;  inifile ini = new inifile(options); ini.load("path input ini file");  // file's sections , keys ...  ini.save("path output ini file"); 

Comments