Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411279 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 04:53:32 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Advanced INI Parser for Unity
Pages: [1]
Print
Author Topic: Advanced INI Parser for Unity  (Read 2271 times)
glintycreative
Guest
« on: September 14, 2014, 12:56:37 PM »

Unity game engine support xml files natively, but not ini. Ini are simple structure files, which are ideal for storing small pieces of information, like game settings, high scores, save data etc...
Therefore, I write a library to handle .ini files for Unity, and I put it here for you to use in your games.

Library features
•   Read, insert, modify, delete section and key value
•   Support cross-platform (using culture-neutral settings and having no .dll dependency)
•   Support string, bool, int, long, double, byte[], DateTime
•   Support ini_file with comments
•   Cache Ini_file content by Dictionary to boost performance
•   Thread-safe access to file with Lock.

Methods
Open(string path)
Open(TextAsset asset)
OpenFromString(string str)
string ToString(string str)
Close()   
string ReadValue(string section, string key, string default)    (+6 overload)
WriteValue(string section, string key, string value)               (+6 overload)
SectionDelete(string section)
bool IsSectionExists(string section)
KeyDelete(string section, string key)
bool IsKeyExists(string section, string key)

Notes
The file can be in any extension (e.g. txt) as long as the content follows .ini format.
Open(TextAsset asset) will enable easy cross-platform ini handle, which sandbox the ini file.

Credits
This library is adapted from STA INIFile and modeled after Game Maker Studio INI file system.

Get the library…
Read more information at http://www.glintycreative.com/blog/?p=133
Download the library at https://www.dropbox.com/s/hncicx2gz4zo2f0/Advanced%20INI%20Parser%20for%20Unity.zip?dl=0

P.S. Although I have tested this library thoroughly and used it in my games, there might be some bugs. If you find some bugs, please reply to this thread so that I can fix the library.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic