Table of Contents

Class RegistryConfiguration

Namespace
SharpConsoleUI.Configuration
Assembly
SharpConsoleUI.dll

Configuration for the registry persistence system.

public record RegistryConfiguration : IEquatable<RegistryConfiguration>
Inheritance
RegistryConfiguration
Implements
Inherited Members
Extension Methods

Constructors

RegistryConfiguration(string, bool, TimeSpan?, IRegistryStorage?)

Configuration for the registry persistence system.

public RegistryConfiguration(string FilePath = "registry.json", bool EagerFlush = false, TimeSpan? FlushInterval = null, IRegistryStorage? Storage = null)

Parameters

FilePath string

Path to the JSON registry file. Relative paths are resolved from the working directory.

EagerFlush bool

If true, every Set call immediately writes to disk. Disabled by default.

FlushInterval TimeSpan?

If set, a background timer flushes to disk on this interval. Null disables timer-based flushing.

Storage IRegistryStorage

Custom storage backend. If null, a JsonFileStorage backed by FilePath is used.

Properties

Default

Default configuration using a platform-appropriate path: Windows: %APPDATA%&lt;appname>\registry.json Linux/macOS: ~/.config/<appname>/registry.json

public static RegistryConfiguration Default { get; }

Property Value

RegistryConfiguration

EagerFlush

If true, every Set call immediately writes to disk. Disabled by default.

public bool EagerFlush { get; init; }

Property Value

bool

FilePath

Path to the JSON registry file. Relative paths are resolved from the working directory.

public string FilePath { get; init; }

Property Value

string

FlushInterval

If set, a background timer flushes to disk on this interval. Null disables timer-based flushing.

public TimeSpan? FlushInterval { get; init; }

Property Value

TimeSpan?

Storage

Custom storage backend. If null, a JsonFileStorage backed by FilePath is used.

public IRegistryStorage? Storage { get; init; }

Property Value

IRegistryStorage

Methods

ForFile(string)

Creates a configuration that persists to the specified file path.

public static RegistryConfiguration ForFile(string filePath)

Parameters

filePath string

Returns

RegistryConfiguration

GetDefaultFilePath()

Returns the platform-appropriate default registry file path. Uses %APPDATA% on Windows and ~/.config on Linux/macOS, with the process name as a subfolder.

public static string GetDefaultFilePath()

Returns

string