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
FilePathstringPath to the JSON registry file. Relative paths are resolved from the working directory.
EagerFlushboolIf true, every Set call immediately writes to disk. Disabled by default.
FlushIntervalTimeSpan?If set, a background timer flushes to disk on this interval. Null disables timer-based flushing.
StorageIRegistryStorageCustom storage backend. If null, a JsonFileStorage backed by FilePath is used.
Properties
Default
Default configuration using a platform-appropriate path: Windows: %APPDATA%<appname>\registry.json Linux/macOS: ~/.config/<appname>/registry.json
public static RegistryConfiguration Default { get; }
Property Value
EagerFlush
If true, every Set call immediately writes to disk. Disabled by default.
public bool EagerFlush { get; init; }
Property Value
FilePath
Path to the JSON registry file. Relative paths are resolved from the working directory.
public string FilePath { get; init; }
Property Value
FlushInterval
If set, a background timer flushes to disk on this interval. Null disables timer-based flushing.
public TimeSpan? FlushInterval { get; init; }
Property Value
Storage
Custom storage backend. If null, a JsonFileStorage backed by FilePath is used.
public IRegistryStorage? Storage { get; init; }
Property Value
Methods
ForFile(string)
Creates a configuration that persists to the specified file path.
public static RegistryConfiguration ForFile(string filePath)
Parameters
filePathstring
Returns
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()