Ejemplo n.º 1
0
 void Save(BackupTask task)
 {
     _cache[task.RelativePath] = new CachedFileInfo {
         LastWriteTimeUtc = task.File.LastWriteTimeUtc,
         Length           = task.File.Length
     };
 }
Ejemplo n.º 2
0
 BackupTask Execute(BackupTask task)
 {
     try {
         var destPath = Path.Combine(_destinationPath, task.RelativePath);
         EnsureDirectory(Path.GetDirectoryName(destPath));
         TrySaveToHistory(destPath);
         File.Copy(task.File.FullName, destPath);
         task.IsSuccess = true;
         Save(task);
     } catch (Exception e) {
         _logger.LogError($"\"{task.RelativePath}\": {e}\n");
     }
     _tracker.UpdateProgress(task.File.Length);
     return(task);
 }