[Release] C# Config Reader v1.0

C# Config Reader

load & read data from ini files

Config Reader is a very basic script to read data from INI files and store it in an organised way.

Current Features

  • Load INI files using natives
  • Simple interface to have easily configurable scripts
  • Simple functions to read INI values (e.g. GetStringValue)
  • Repeated Key support (adds -index to keys that are repeated) e.g. name-2 (for future development)
  • How To Use

  • Download the Config Reader.zip
  • Extract the zip
  • Add ConfigReader.cs to your project
  • Set a reference to this script
  • Create an instance of the iniconfig class:
  • Call Get value functions to read data

  • Config Reader.zip (3.2 KB)
    Source File

    Example code to read a string value from an INI:

    using Config.Reader;
    iniconfig config = new iniconfig("test","config.ini");
    void RandomMethod()
       string value = config.GetStringValue("section","key","fallback");

    Remember to add your ini file to your __resource.lua file, like so:

    file 'config.ini'

    Thank you so much for this, I was thinking about creating something like this myself but was putting it off to the side! I will keep this in my library for eternity.

    EDIT: I was also playing around w/ it and I had to change the class because of name rule violations, this violations, and framework violations (this is just because of how I use my Visual Studio and how it is setup for me). This is my edited version: Github Gist link

    1 Like

    No problem, I was missing scriptsettings from normal gta v modding, hope this helps!

    i want to read my ini file and in its this code:

    pls help

    Do you have an example of config?

    Is this outdated now?