Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

INISystem

Discussion in 'Assets and Asset Store' started by CorruptedHeart, Nov 18, 2011.

  1. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Current Version: 2.0

    This is a fairly simple .ini file reader/writer. This greatly simplifies the reading and editing of config files. It includes parsers for most of Unity's DataTypes and some basic Mono DataTypes. It includes the ability to have default values if the system can not find the specified value.

    It also supports [Sections].

    Name: INISystem
    Source Code: C#
    Price: $ 10
    Unity Version: 3.4.1
    Works with Unity Free
    Asset Store Link.
    Issue Tracker - For bugs and features requests.

    Change Log:
    Version 2.0
    Major breaking changes in this version.
    • The INISystem and INIHelper classes are gone.
    • A new static INIFile class is available for reading and writing INI files.
    • A new parent class INIContent that contains most standard DataTypes and a sub-class INIUnity that contains most of Unity's DataTypes.
    Version 1.11
    • Small bug fixes
    • Namespace has changed to CorruptedSmileStudio.INI
    • Base class is now compiled in a DLL
    Version 1.1
    • Added some basic data-type parsers to the base class
    • Floats
    • Ints
    • Bools
    • Added some parsers of Unity's data-types
    • Color
    • Vector2
    • Vector3
    • Quaternion
    Version 1.0
    • Reads ini files
    • Edits ini files
    • Creates ini files
    • Option for separate thread for file parsing
    Regards,
    Garth (Corrupted Smile Studio)
     
    Last edited: Apr 16, 2012
  2. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    I need this.But, can we read strings only? or did you already implement some float, vector, color...etc parsers?
    How does it work?
     
  4. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    There are currently no parsers. In order to try keep the system as easy to use as possible it will only read strings, so all parsing will have to be done by you. However, I might implement some basic parsing of ints, floats and so on in the future if there is demand for it.

    For loading the usage is as simple as:
    Code (csharp):
    1. INISystem ini = new INISystem();
    2. // Returns true if file loaded successfully.
    3. if(ini.LoadFile(pathToIniFile))
    4.     Debug.Log("File Loaded");
    5. else
    6.     Debug.Log("File not Loaded");
    7. // Default value is optional.
    8. string exampleText = ini.Get("exampleText", "SectionName", "Default value if no value is found");
    9. int someValue = int.Parse(ini.Get("someValue", "AnotherSection", "10");
    The for making changes, creating and so on:
    Code (csharp):
    1. INISystem ini = new INISystem();
    2. ini.Change("exampleText", "New Text", "SectionName");
    3. ini.Change("someValue", newValue.ToString(), "AnotherSection");
    4. if(ini.Save(pathToFile))
    5.     Debug.Log("Save successful");
    6. else
    7.     Debug.Log("Save unsuccessful");
    Regards,
    Garth
     
  5. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I did some work on various parsers for some of Unity's main data-types (Color, Vector2, Vector3, Quaternion). I put these into a static INIHelper class. When you call the methods GetVector2 for example, you will need to pass in a reference to the INISystem class that you have created.

    I also added some basic data-types parsers for floats, ints and bools to the base class. I've uploaded the new version to Unity's Asset Store, hopefully it will be available sometime this week.

    Regards,
    Garth
     
  6. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I just pushed a bug fix release to the Asset Store. This version will bring with it one or two breaking changes.
    The most important one being that all classes for INISystem are now under CorruptedSmileStudio.INI namespace.

    So you will need to include using CorruptedSmileStudio.INI;
    At the top of files creating a INISystem class or using the new INIHelper class.

    In this version the INISystem class is compiled into a DLL to try and ensure that any bugs arising from the system are not caused by other programmers chopping the code. The INIHelper class is not included in the DLL, which makes it possible for you to add your own parsers to the class.

    Regards,
    Garth
     
  7. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Version 1.11 is live on the Asset Store, get it while its hot. :)
     
  8. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I was hoping that those who have purchased this and used it, wouldn't mind writing a review on the Asset Store for it. Or in fact just posting some feedback here.

    Regards,
    Garth
     
  9. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I have made some breaking changes to the system in a version 2.0 release that is currently awaiting Unity's Approval on the Asset Store.

    Change Log:
    B]Version 2.0[/B]
    • The INISystem and INIHelper classes are gone.
    • A new static INIFile class is available for reading and writing INI files.
    • A new parent class INIContent that contains most standard DataTypes and a sub-class INIUnity that contains most of Unity's DataTypes.

    Still at the low price of $10.

    Regards,
    Garth
     
  10. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Version 2.0 is now available on the Asset Store.
     
  11. timsk

    timsk

    Joined:
    May 27, 2011
    Posts:
    177
    Good bargain for $10. Does exactly what it said on the tin. Saved me writing my own, cheers! :).
     
  12. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Thanks, hope you put it to good use, if you come across any issues or feature requests just let me know.

    Regards,
    Garth