Skip to main content
View as Markdown

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​

MethodReturnsDescription
ReadBooleanboolThis ReadBoolean method retrieves a boolean value for the specified server and the setting name that are represented by the system wide Preferences dialog.
ReadDoubledoubleThis ReadDouble method retrieves a double value for the specified server and the setting name that are represented by the system wide Preferences dialog.
ReadIntegerintThis ReadInteger method retrieves an integral value for the specified server and the setting name that are represented by the system wide Preferences dialog.
ReadSectionstringThis method retrieves the data for the section which is the targetted page in the system wide Preferences dialog.
ReadStringstringThis ReadString method retrieves a string value for the specified server and the setting name that are represented by the system wide Preferences dialog.
SectionExistsboolThis method checks whether the section (or the targetted page) exists or not.
ValueExistsboolThis 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);
ParameterTypePassingDescription
argSectionNamestringvalueThe target server's page in the system wide preferences dialog.
argValueNamestringvalue
argDefaultValueboolvalueThe 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);
ParameterTypePassing
argSectionNamestringvalue
argValueNamestringvalue
argDefaultValuedoublevalue

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);
ParameterTypePassing
argSectionNamestringvalue
argValueNamestringvalue
argDefaultValueintvalue

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);
ParameterTypePassing
argSectionNamestringvalue

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);
ParameterTypePassing
argSectionNamestringvalue
argValueNamestringvalue
argDefaultValuestringvalue

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);
ParameterTypePassing
argSectionNamestringvalue

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);
ParameterTypePassing
argSectionNamestringvalue
argValueNamestringvalue

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.