
# 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.

```csharp
public interface IOptionsReader
```

**Namespace:** DXP · **Assembly:** Altium.SDK.Interfaces

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [ReadBoolean](#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](#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](#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](#readsection) | `string` | This method retrieves the data for the section which is the targetted page in the system wide Preferences dialog. |
| [ReadString](#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](#sectionexists) | `bool` | This method checks whether the section (or the targetted page) exists or not. |
| [ValueExists](#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.

```csharp
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.

```csharp
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](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SchPreference/Source%20Code/Commands.cs#L28), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L49)

### 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.

```csharp
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.

```csharp
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.

```csharp
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.

```csharp
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](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Ciiva/Source%20Code/Preferences.cs#L29), [Extension_Preference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Preference/Source%20Code/Preferences.cs#L32), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L33)

### SectionExists

This method checks whether the section (or the targetted page) exists or not.

```csharp
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.

```csharp
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](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IOptionsManager.md#getoptionsreader), [IOptionsManager.GetOptionsReader_FromIniFile](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IOptionsManager.md#getoptionsreader_frominifile), [Utils.ServerOptionsReader](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Utils.md#serveroptionsreader)

## Accepted by

[IReportOutputOptions.Import_FromOptionsReader](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IReportOutputOptions.md#import_fromoptionsreader), [IReportOutputTransformation.Import_FromOptionsReader](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IReportOutputTransformation.md#import_fromoptionsreader), [IVcsDesignVault.LoadFromIni](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IVcsDesignVault.md#loadfromini), [IVcsProvider.LoadDesignVaultsFromIni](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IVcsProvider.md#loaddesignvaultsfromini), [ISch_JunctionConvertSettings.Import_FromIniFile](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_JunctionConvertSettings.md#import_frominifile)

## Examples

Used in the SDK examples: [Ciiva](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Ciiva/Source%20Code/Preferences.cs#L27), [Extension_Preference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Preference/Source%20Code/Preferences.cs#L30), [Extension_SchPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SchPreference/Source%20Code/Commands.cs#L25), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L25).
