ProfileStore
- Namespace:
PPDS.Auth.Profiles - Assembly:
PPDS.Auth - Kind: Class
- Implements:
IDisposable
Summary
Manages persistent storage of authentication profiles.
Members
Constructors
ProfileStore(ILogger logger)
ProfileStore(ILogger logger)
Creates a new profile store using the default path.
- Param
logger: Optional logger for diagnostics.
ProfileStore(string filePath, ILogger logger)
ProfileStore(string filePath, ILogger logger)
Creates a new profile store using a custom path.
-
Param
filePath: The path to the profiles file. -
Param
logger: Optional logger for diagnostics.
Methods
ClearCache
void ClearCache()
Clears the cached collection, forcing a reload on next access.
Delete
void Delete()
Deletes the profile storage file and clears the cache.
Dispose
void Dispose()
(inherited from System.IDisposable.Dispose)
Load
ProfileCollection Load()
Loads the profile collection from disk (synchronous).
- Returns: The profile collection.
LoadAsync
Task<ProfileCollection> LoadAsync(CancellationToken cancellationToken)
Loads the profile collection from disk.
-
Param
cancellationToken: Cancellation token. -
Returns: The profile collection.
Save
void Save(ProfileCollection collection)
Saves the profile collection to disk (synchronous).
- Param
collection: The collection to save.
SaveAsync
Task SaveAsync(ProfileCollection collection, CancellationToken cancellationToken)
Saves the profile collection to disk.
-
Param
collection: The collection to save. -
Param
cancellationToken: Cancellation token.
UpdateProfileAsync
Task<bool> UpdateProfileAsync(string profileNameOrIndex, Action<AuthProfile> updateAction, CancellationToken cancellationToken)
Updates a specific profile using an update action.
-
Param
profileNameOrIndex: The name or index (including bracket notation like "[1]") of the profile to update. -
Param
updateAction: Action to apply to the profile. -
Param
cancellationToken: Cancellation token. -
Returns: True if the profile was found and updated, false otherwise.
Properties
FilePath
string FilePath { get; }
Gets the path to the profiles file.
Fields
CurrentVersion
int CurrentVersion
Current schema version.