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
fileSystemIFileSystemThe file system Rubberduck's configuration is in.
applicationDatastringThe roaming application data folder of the user:
%APPDATA%; empty where there is none.registryILegacyIndenterRegistryThe registry.
isWindowsboolWhether 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
applicationDatastringThe user's application data folder.
Returns
ForThisMachine()
The reader of this machine: where Rubberduck keeps its settings on Windows, and nothing elsewhere.
public static RubberduckIndenterSettingsReader ForThisMachine()
Returns
FromConfigXml(string)
The children of the IndenterSettings of a Rubberduck configuration file (Rubberduck Configuration.UserSettings.IndenterSettings).
public static RubberduckIndenterSettingsResult? FromConfigXml(string xml)
Parameters
xmlstringThe 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
smartIndenterIReadOnlyDictionary<string, object>tabWidthint?The
TabWidthof the VBA editor.
Returns
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.