Unity: c# .ini parser big update

Previous post: http://blog.kennyist.com/?p=864

Github: https://github.com/kennyist/Unity_tools

In this version i have added the ability to have sections and have also updated the ini formatting. With sections you can also use multiple keys with the same name as long as they are in different sections. The usage is pretty much the same as the previous with a few minor changes:

Usage update:

the main difference is to setting and getting. To set you now have to use:

Key section can be empty and will show up in the ini at the top with all other nu-sectioned keys. You still add a comment like so:

Getting the key is exactly the same, But if you have multiple of the same name, it will only return the first. So there is now a new Get overload:

 The saved ini file:

So if i was creating an ini with differant sections like so (doesnt matter what order you use):

It will be shown like this in the .ini file:

One main difference is that comments are displayed 60 characters away from line start, meaning you can only use 60 characters for name and value, This can be easily changed in the Save method.


The code is now available on gitHub: https://github.com/kennyist/Unity_tools

Leave a Reply

Your email address will not be published. Required fields are marked *

7 − = two