IniFileReadKey
Reads the value of a key from the currently loaded configuration file.
- If the key exists and its value is not blank then its value is returned.
- If the key does not exist or its value is blank then string.Empty is returned.
Parameters:
sectionName
The name of the section where the key exists or will be added.
keyName
The key identifier.
Return Value:
The value string part of the key / value pair.
Interface Signature:
string IniFileReadKey(string sectionName, string keyName);
An example of how this function could be used is shown below.
using System;
namespace Example
{
/// <summary>
/// An simple example of how to utilize the API and get a reference to it
/// </summary>
public class ExampleClass
{
/// <summary>
/// Get the a calibration's directory to use
/// </summary>
public static string GetDirectoryToUse(string calName)
{
// Get a reference to the API interface
AteSystems.InCal.IApi api = AteSystems.InCal.API.Initialize(@"C:\Temp\MyConfig.ini", catchExceptions:true);
// Call the API function
return api.IniFileReadKey(calName, "DirectoryToUse");
}
}
}