EasySave v3.0
Loading...
Searching...
No Matches
EasySave.Gui.MutableEasySavePaths Class Referencesealed

Mutable version of EasySavePaths allowing to change the base directory at runtime. When changing the path, existing configuration, state and log files are copied to the new location so that no data is lost. More...

Public Member Functions

 MutableEasySavePaths (string baseDirectory)
 Initializes a new instance with the given base directory.
async Task< bool > SetBaseDirectoryAsync (string newBaseDirectory, CancellationToken cancellationToken=default)
 Changes the base directory to the new path. Copies existing backup-config.json, state.json and all daily log files (*.json, *.xml) from the current location to the new one so that no data is lost, then switches to the new path.
EasySavePaths Snapshot ()
 Returns a snapshot with the same shape as EasySavePaths for backward compatibility.

Properties

string BaseDirectory [get]
 Directory containing configuration, state and log files.
string ConfigFilePath [get]
 Full path to backup-config.json.
string StateFilePath [get]
 Full path to state.json.
string LogDirectory [get]
 Directory where daily log files are stored.

Events

EventHandler? PathsChanged
 Raised when the base directory has been changed (after files have been copied).

Detailed Description

Mutable version of EasySavePaths allowing to change the base directory at runtime. When changing the path, existing configuration, state and log files are copied to the new location so that no data is lost.

Member Function Documentation

◆ SetBaseDirectoryAsync()

async Task< bool > EasySave.Gui.MutableEasySavePaths.SetBaseDirectoryAsync ( string newBaseDirectory,
CancellationToken cancellationToken = default )

Changes the base directory to the new path. Copies existing backup-config.json, state.json and all daily log files (*.json, *.xml) from the current location to the new one so that no data is lost, then switches to the new path.

Parameters
newBaseDirectoryThe new base directory (will be created if needed).
cancellationTokenOptional cancellation token.
Returns
True if the path was changed, false if the new path is the same as the current one.

The documentation for this class was generated from the following file:
  • EasySave.Gui/MutableEasySavePaths.cs