/
Config files

Config files

General

StockControl uses config files for most configuration settings for the agents and the client. These are old-school Windows INI files.

Each agent has a static superglobal called Config that is initialised during startup with the following code:

Config.Init(typeof(Program))

in the Program.cs file. This will look for a file named after the program in the config/ folder, e.g. config/Sapphire Control Center.ini.

If the config file cannot be found, the agent will not start.

Sections

Most agents have their own defined sections and document of those can be found on the (sub)page of the agent. Most have at least the [general] and [database] sections.

Reading configuration settings

By default, whenever reading a setting, you can provide a default, which will be written into the config file. There are several helper methods to read info from the config file:

static public int GetInt(string section, string key, int def) static public bool GetBool(string section, string key, bool def) static public string[] GetStringArray(string section, string key, char delimiter = ',') static public string GetPassword(string section, string key, string def)

The GetPassword will encode the string in Base64. This isn’t really encryption, but thwarts basic snoopers. When providing a password starting with @ it is presumed unencrypted (e.g. when written in the INI file) and will be replaced with an encrypted version.

Related content

StockControl Agent
StockControl Agent
More like this
Pocket Connector
Read with this
Default Configuration
Default Configuration
More like this
Older Documentation
Older Documentation
Read with this
Software Components
Software Components
More like this