Table of Contents

Nucs.JsonSettings API Reference

This reference is generated from the source of the Nucs.JsonSettings and Nucs.JsonSettings.Autosave assemblies. It is organized below by area; use the table of contents on the left to browse every namespace and type.


Core types

The essentials for defining and loading settings.

Type Description
JsonSettings The abstract base class you inherit for a typed, hardcoded settings POCO. Exposes Load, Construct, Configure, Save, and the load/save event pipeline.
SettingsBag A ready-made dynamic key/value settings object; no class to define.
DynamicSettingsBag The dynamic view returned by SettingsBag.AsDynamic().
JsonSettingsException Base exception type thrown by the library.

Interfaces

Type Description
ISavable The savable contract (FileName, Save, load hooks).
IEncryptedSavable An ISavable that carries a key for encryption.

Quick example

using Nucs.JsonSettings;

class MySettings : JsonSettings {
    public override string FileName { get; set; } = "config.json";
    public string Name { get; set; } = "default";
}

var settings = JsonSettings.Load<MySettings>("config.json");
settings.Name = "ok";
settings.Save();

Fluent configuration

The extension methods that build a configured settings object. See The Basics.

Type Description
FluentJsonSettings WithFileName, WithModule, WithEncryption, WithBase64, WithVersioning, WithRecovery, WithDefaultValues, LoadNow.

Modulation

The per-object module system. See the Modulation API.

Type Description
Module Abstract base for a module; override Attach/Deattach.
ModuleSocket Holds the modules attached to a settings object (JsonSettings.Modulation).
ISocket The socket contract modules attach to.
Base64Module Encodes the payload as Base64.
EncryptionModule Symmetric encryption of the payload (AES-256-CBC by default; AES-GCM/CCM, ChaCha20-Poly1305, AES-CBC-HMAC). See Encryption.
ModularityException Thrown on invalid module attachment/state.
SuspensionModule The neutral save-suspension state (gates + reference-counted suspension) both autosave paths share.
SettingsBagAutosaveModule The module SettingsBag attaches for its dictionary-backed autosave (base package).

Versioning

Enforce a schema version. See Versioning.

Type Description
IVersionable Contributes a Version Version { get; set; } property.
VersioningModule<T> The module that enforces a version policy (Nucs.JsonSettings.Modulation).
VersioningResultAction What to do on a version mismatch: DoNothing, Throw, RenameAndLoadDefault, LoadDefault, LoadDefaultAndSave.
EnforcedVersionAttribute Declares the enforced version on the Version property.
InvalidVersionException Thrown when the action is Throw.

Recovery

Handle parse failures. See Recovery.

Type Description
RecoveryModule Recovers when the file fails to parse.
RecoveryAction Throw, RenameAndLoadDefault, LoadDefault, LoadDefaultAndSave.
JsonSettingsRecoveryException Wraps the underlying parse exception.

Autosave

Save automatically on change (ships in Nucs.JsonSettings.Autosave). See Autosave.

Type Description
JsonSettingsAutosaveExtensions EnableAutosave / EnableIAutosave entry points.
AutosaveModule The module EnableAutosave() attaches: the monitored-property set and the notification-binder slot, on top of SuspensionModule.
IgnoreAutosaveAttribute Excludes a property from autosave monitoring.
NotificationBinder Binds INotifyPropertyChanged/INotifyCollectionChanged sources for WPF-style autosave.

NotifiyingJsonSettings (in the Nucs.JsonSettings namespace) is the convenient INotifyPropertyChanged base class for WPF-style settings.


Helpers

Type Description
@Nucs.JsonSettings.Inline.Paths Path resolution helpers used when resolving FileName.

See also