Table of Contents

Class BackupManager

Namespace
RadioExt_Helper.utility
Assembly
RadioExt-Helper.dll
Represents a class for managing the backup of files and folders. Subscribe to the event handlers to track the backup operation.
public class BackupManager
Inheritance
BackupManager
Inherited Members

Constructors

BackupManager(CompressionLevel)

Represents a class for managing the backup of files and folders. Subscribe to the event handlers to track the backup operation.
public BackupManager(CompressionLevel level)

Parameters

level CompressionLevel

Properties

BackupCompressionLevel

Get or set the compression level used for the backup operation.
public CompressionLevel BackupCompressionLevel { get; }

Property Value

CompressionLevel

Methods

BackupStagingFolderAsync(string, string, bool)

Asynchronously backs up the contents of the staging folder to a zip file in the backup folder.
public Task BackupStagingFolderAsync(string stagingPath, string backupPath, bool shouldCopySongFiles)

Parameters

stagingPath string
The path to the staging folder.
backupPath string
The path to a backup folder.
shouldCopySongFiles bool
Indicate whether the actual song files should be included in the backed up file or not.

Returns

Task
A Task representing the backup operation.

Exceptions

ArgumentNullException
If either stagingPath or backupPath are null or empty.
ArgumentException
If the backup path is the same as the staging path.
ArgumentException
If the compression level is not between 0 and 9.

CancelBackup()

public void CancelBackup()

CancelRestore()

public void CancelRestore()

GetBackupPreviewAsync(string)

Asynchronously get a preview of the files that will be backed up from the staging folder.

The preview includes a list of FilePreview objects, the total size of the files, and the estimated compressed size.

public Task GetBackupPreviewAsync(string stagingPath)

Parameters

stagingPath string
The path to preview the backup of.

Returns

Task
A task representing the asynchronous operation.

Exceptions

ArgumentNullException
Occurs if the stagingPath is null or empty.

GetRestorePreviewAsync(string)

Asynchronously get a preview of the files that will be restored to the staging folder.

The preview includes a list of FilePreview objects and the total size of the files.

public Task GetRestorePreviewAsync(string backupFilePath)

Parameters

backupFilePath string
The path of the backed up .zip to preview.

Returns

Task
A task representing the asynchronous operation.

Exceptions

ArgumentNullException
Occurs if the backupFilePath is null or empty.

RestoreBackupAsync(string, string)

Asynchronously restores the contents of a backup zip file to the specified restore path, handling external song files.
public Task RestoreBackupAsync(string backupFilePath, string restorePath)

Parameters

backupFilePath string
The path to the backup zip file.
restorePath string
The path to the directory the .zip file should be restored to.

Returns

Task
A task representing the restore operation.

Events

BackupCompleted

Occurs whenever the backup operation is completed.

Event data includes a flag indicating success, the path to the backup folder, and backup file name.

public event Action<bool, string, string>? BackupCompleted

Event Type

Action<bool, string, string>

BackupPreviewCompleted

Occurs whenever the backup preview operation is completed.

Event data is a tuple with the list of previews, the total size of the files, and the estimated compressed size.

public event Action<(List<FilePreview> Previews, long TotalSize, long EstimatedCompressedSize)>? BackupPreviewCompleted

Event Type

Action<(List<FilePreview> Previews, long TotalSize, long EstimatedCompressedSize)>

PreviewProgressChanged

Occurs whenever the progress of the backup preview or restore preview operation changes.

Event data includes the current progress percentage.

public event Action<int>? PreviewProgressChanged

Event Type

Action<int>

PreviewStatusChanged

Occurs whenever the status of the backup preview operation changes.

Event data is a tuple containing the current FilePreview object and the current estimated backup size, in bytes.

public event Action<(FilePreview, long)>? PreviewStatusChanged

Event Type

Action<(FilePreview, long)>

ProgressChanged

Occurs whenever the progress of the backup operation changes.

Event data includes the current progress percentage.

public event Action<int>? ProgressChanged

Event Type

Action<int>

RestoreCompleted

Occurs whenever the restore operation is completed.

Event data includes a flag indicating success and the restore path.

public event Action<bool, string>? RestoreCompleted

Event Type

Action<bool, string>

RestorePreviewCompleted

Occurs whenever the status of the restore preview operation changes.

Event data is a tuple containing the current FilePreview object and the current estimated restore size, in bytes.

public event Action<(List<FilePreview>, long)>? RestorePreviewCompleted

Event Type

Action<(List<FilePreview>, long)>

StatusChanged

Occurs whenever the status of the backup operation changes.

Event data includes a message describing the current status.

public event Action<string>? StatusChanged

Event Type

Action<string>