IOptionsReader interface
The IOptionsReader interface reads values for options on a page in the system wide Preferences dialog or Project options dialog from the registry storage.
public interface IOptionsReader
Namespace: DXP · Assembly: Altium.SDK.Interfaces
Methods
| Method | Returns | Description |
|---|---|---|
| ReadBoolean | bool | This ReadBoolean method retrieves a boolean value for the specified server and the setting name that are represented by the system wide Preferences dialog. |
| ReadDouble | double | This ReadDouble method retrieves a double value for the specified server and the setting name that are represented by the system wide Preferences dialog. |
| ReadInteger | int | This ReadInteger method retrieves an integral value for the specified server and the setting name that are represented by the system wide Preferences dialog. |
| ReadSection | string | This method retrieves the data for the section which is the targetted page in the system wide Preferences dialog. |
| ReadString | string | This ReadString method retrieves a string value for the specified server and the setting name that are represented by the system wide Preferences dialog. |
| SectionExists | bool | This method checks whether the section (or the targetted page) exists or not. |
| ValueExists | bool | This method determines whether the value name exists for this section name. |
ReadBoolean
This ReadBoolean method retrieves a boolean value for the specified server and the setting name that are represented by the system wide Preferences dialog.
bool ReadBoolean(string argSectionName, string argValueName, bool argDefaultValue);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argSectionName | string | value | The target server's page in the system wide preferences dialog. |
argValueName | string | value | |
argDefaultValue | bool | value | The value returned if the specific control on the Preferences dialog is not returning a valid Boolean value. |
Returns: bool
Example: Read a Boolean option of a server.
using DXP;
// Placeholders: your server's name, its preferences section, the option and its default value.
string nameOfServer = "<server name>";
string nameOfServerPreferences = "<preferences section>";
string settingName = "<option name>";
bool defaultValue = false;
IOptionsReader reader = DXP.GlobalVars.Client.GetOptionsManager().GetOptionsReader(nameOfServer, "");
if (reader == null)
return;
bool aValue = reader.ReadBoolean(nameOfServerPreferences, settingName, defaultValue);
Examples: Extension_SchPreference, Extension_SupplierPreference
ReadDouble
This ReadDouble method retrieves a double value for the specified server and the setting name that are represented by the system wide Preferences dialog.
double ReadDouble(string argSectionName, string argValueName, double argDefaultValue);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
argValueName | string | value |
argDefaultValue | double | value |
Returns: double
The section name is the targetted page in the system wide preferences dialog.
ReadInteger
This ReadInteger method retrieves an integral value for the specified server and the setting name that are represented by the system wide Preferences dialog.
int ReadInteger(string argSectionName, string argValueName, int argDefaultValue);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
argValueName | string | value |
argDefaultValue | int | value |
Returns: int
The section name is the targetted page in the system wide preferences dialog.
ReadSection
This method retrieves the data for the section which is the targetted page in the system wide Preferences dialog.
string ReadSection(string argSectionName);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
Returns: string
Note the section name is the targetted page in the system wide preferences dialog.
ReadString
This ReadString method retrieves a string value for the specified server and the setting name that are represented by the system wide Preferences dialog.
string ReadString(string argSectionName, string argValueName, string argDefaultValue);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
argValueName | string | value |
argDefaultValue | string | value |
Returns: string
The section name is the targetted page in the system wide preferences dialog.
Examples: Ciiva, Extension_Preference, Extension_SupplierPreference
SectionExists
This method checks whether the section (or the targetted page) exists or not.
bool SectionExists(string argSectionName);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
Returns: bool
The section name is the targetted page in the system wide preferences dialog.
ValueExists
This method determines whether the value name exists for this section name. This is useful if you need to check if a value name exists in the registry storage before you commit a value to this location.
bool ValueExists(string argSectionName, string argValueName);
| Parameter | Type | Passing |
|---|---|---|
argSectionName | string | value |
argValueName | string | value |
Returns: bool
The section name is the targetted page in the system wide preferences dialog.
Returned by
IOptionsManager.GetOptionsReader, IOptionsManager.GetOptionsReader_FromIniFile, Utils.ServerOptionsReader
Accepted by
IReportOutputOptions.Import_FromOptionsReader, IReportOutputTransformation.Import_FromOptionsReader, IVcsDesignVault.LoadFromIni, IVcsProvider.LoadDesignVaultsFromIni, ISch_JunctionConvertSettings.Import_FromIniFile
Examples
Used in the SDK examples: Ciiva, Extension_Preference, Extension_SchPreference, Extension_SupplierPreference.