Table of Contents

Class RubberduckIndenterSettingsReader

Namespace
RDCore.SDK.Formatting
Assembly
RDCore.SDK.dll

Reads the indenter settings of Rubberduck where they are, as they are: what a client answers rdcore/formatting/indenterSettings with (RubberduckIndenterSettingsParams).

public sealed class RubberduckIndenterSettingsReader
Inheritance
RubberduckIndenterSettingsReader
Inherited Members

Remarks

Two places have them, on Windows: Rubberduck's own configuration, %APPDATA%\Rubberduck\rubberduck.config (XML, the children of its IndenterSettings section), and the registry key of the legacy Smart Indenter (ILegacyIndenterRegistry). Rubberduck's own configuration is the more recent of the two, and is the one read when both have settings. On any other platform there is nothing to read.

This reads and maps nothing: the names are Rubberduck's, the values are theirs (From(RubberduckIndenterSettingsResult) maps them).

Constructors

RubberduckIndenterSettingsReader(IFileSystem, string, ILegacyIndenterRegistry, bool)

Reads the indenter settings of Rubberduck where they are, as they are: what a client answers rdcore/formatting/indenterSettings with (RubberduckIndenterSettingsParams).

public RubberduckIndenterSettingsReader(IFileSystem fileSystem, string applicationData, ILegacyIndenterRegistry registry, bool isWindows)

Parameters

fileSystem IFileSystem

The file system Rubberduck's configuration is in.

applicationData string

The roaming application data folder of the user: %APPDATA%; empty where there is none.

registry ILegacyIndenterRegistry

The registry.

isWindows bool

Whether the platform is Windows, which the sources are of.

Remarks

Two places have them, on Windows: Rubberduck's own configuration, %APPDATA%\Rubberduck\rubberduck.config (XML, the children of its IndenterSettings section), and the registry key of the legacy Smart Indenter (ILegacyIndenterRegistry). Rubberduck's own configuration is the more recent of the two, and is the one read when both have settings. On any other platform there is nothing to read.

This reads and maps nothing: the names are Rubberduck's, the values are theirs (From(RubberduckIndenterSettingsResult) maps them).

Methods

ConfigPathIn(string)

The path of Rubberduck's configuration file, under the user's application data.

public static string ConfigPathIn(string applicationData)

Parameters

applicationData string

The user's application data folder.

Returns

string

ForThisMachine()

The reader of this machine: where Rubberduck keeps its settings on Windows, and nothing elsewhere.

public static RubberduckIndenterSettingsReader ForThisMachine()

Returns

RubberduckIndenterSettingsReader

FromConfigXml(string)

The children of the IndenterSettings of a Rubberduck configuration file (Rubberduck Configuration.UserSettings.IndenterSettings).

public static RubberduckIndenterSettingsResult? FromConfigXml(string xml)

Parameters

xml string

The text of the file.

Returns

RubberduckIndenterSettingsResult

The settings, each by its name with its text; null when the file is not XML, or has no indenter settings.

FromSmartIndenter(IReadOnlyDictionary<string, object>, int?)

The settings of the legacy Smart Indenter, from the values of its registry key.

public static RubberduckIndenterSettingsResult FromSmartIndenter(IReadOnlyDictionary<string, object> smartIndenter, int? tabWidth)

Parameters

smartIndenter IReadOnlyDictionary<string, object>

The values of the key by name, a int or a string each.

tabWidth int?

The TabWidth of the VBA editor.

Returns

RubberduckIndenterSettingsResult

Read()

Reads the settings.

public RubberduckIndenterSettingsResult Read()

Returns

RubberduckIndenterSettingsResult

The settings as they are; Nothing when there are none, or the platform is not Windows.