Class AJobStrategyService
Abstract class defining a backup strategy. Implements the IJobStrategyService interface and enforces the implementation of the Execute method in derived classes.
Implements
Inherited Members
Namespace: EasySave_Project.Service
Assembly: .dll
Syntax
public abstract class AJobStrategyService : IJobStrategyService
Methods
| Edit this page View SourceCopyFileWithSemaphore(string, string, JobModel, bool, ref int, ref long, List<string>, int, long)
Declaration
protected bool CopyFileWithSemaphore(string sourceFileWithAbsolutePath, string targetDir, JobModel job, bool isLargeFile, ref int processedFiles, ref long processedSize, List<string> filesToCopyPath, int totalFiles, long totalSize)
Parameters
Type | Name | Description |
---|---|---|
string | sourceFileWithAbsolutePath | |
string | targetDir | |
JobModel | job | |
bool | isLargeFile | |
int | processedFiles | |
long | processedSize | |
List<string> | filesToCopyPath | |
int | totalFiles | |
long | totalSize |
Returns
Type | Description |
---|---|
bool |
Execute(JobModel, string)
Executes the backup job using the specified job model and target backup directory. This method must be implemented by derived classes.
Declaration
public abstract void Execute(JobModel job, string backupDir)
Parameters
Type | Name | Description |
---|---|---|
JobModel | job | The JobModel object representing the job to execute. |
string | backupDir | The directory where the backup will be stored. |
HandleFileOperation(string, string, JobModel, double)
Declaration
public long HandleFileOperation(string sourcePath, string targetPath, JobModel job, double progress)
Parameters
Type | Name | Description |
---|---|---|
string | sourcePath | |
string | targetPath | |
JobModel | job | The JobModel object representing the job to execute. |
double | progress |
Returns
Type | Description |
---|---|
long | Elapsed time for encryption or 0 if no encryption occurred. |
IsEncryptedFileFormat(string)
Checks if a given file format is in the list of encrypted file extensions.
Declaration
public bool IsEncryptedFileFormat(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format | The file format to check (e.g., ".txt"). |
Returns
Type | Description |
---|---|
bool | True if the format is present, otherwise False. |
ProcessFallbackQueue(Queue<string>, string, JobModel, ref int, ref long, List<string>, int, long)
Declaration
protected void ProcessFallbackQueue(Queue<string> fallbackQueue, string targetDir, JobModel job, ref int processedFiles, ref long processedSize, List<string> filesToCopyPath, int totalFiles, long totalSize)
Parameters
Type | Name | Description |
---|---|---|
Queue<string> | fallbackQueue | |
string | targetDir | |
JobModel | job | |
int | processedFiles | |
long | processedSize | |
List<string> | filesToCopyPath | |
int | totalFiles | |
long | totalSize |
ProcessFilesInQueue(Queue<string>, Queue<string>, string, JobModel, ref int, ref long, List<string>, int, long)
Declaration
protected void ProcessFilesInQueue(Queue<string> files, Queue<string> fallbackQueue, string targetDir, JobModel job, ref int processedFiles, ref long processedSize, List<string> filesToCopyPath, int totalFiles, long totalSize)
Parameters
Type | Name | Description |
---|---|---|
Queue<string> | files | |
Queue<string> | fallbackQueue | |
string | targetDir | |
JobModel | job | |
int | processedFiles | |
long | processedSize | |
List<string> | filesToCopyPath | |
int | totalFiles | |
long | totalSize |
SaveFileInPending(JobModel, List<string>, int, long, int, long, string)
Saves the current state of pending files in a backup job. This method updates the JobModel with details about the files yet to be processed, along with progress metrics such as the number of processed files, processed size, total files, and total size.
Declaration
protected void SaveFileInPending(JobModel job, List<string> filesToSave, int processedFiles, long processedSize, int totalFiles, long totalSize, string lastDateTimePath)
Parameters
Type | Name | Description |
---|---|---|
JobModel | job | The JobModel representing the backup job. |
List<string> | filesToSave | The list of file paths that are still pending processing. |
int | processedFiles | The number of files that have been processed so far. |
long | processedSize | The total size of the files that have been processed. |
int | totalFiles | The total number of files in the backup job. |
long | totalSize | The total size of all files in the backup job. |
string | lastDateTimePath |
UpdateBackupState(JobModel, int, long, int, long, string, string, double, string)
Updates the backup state in the StateManager during the backup process.
Declaration
protected void UpdateBackupState(JobModel job, int processedFiles, long processedSize, int totalFiles, long totalSize, string currentSourceFilePath, string currentDestinationFilePath, double progressPourcentage, string lastDateTimePath)
Parameters
Type | Name | Description |
---|---|---|
JobModel | job | |
int | processedFiles | |
long | processedSize | |
int | totalFiles | |
long | totalSize | |
string | currentSourceFilePath | |
string | currentDestinationFilePath | |
double | progressPourcentage | |
string | lastDateTimePath |
changeJobStateIfBusinessProcessLaunching(JobModel)
Declaration
protected void changeJobStateIfBusinessProcessLaunching(JobModel job)
Parameters
Type | Name | Description |
---|---|---|
JobModel | job |
Events
| Edit this page View SourceOnProgressChanged
Declaration
public event Action<double>? OnProgressChanged
Event Type
Type | Description |
---|---|
Action<double> |