private async Task RestoreFileAsync( EntryUpdateInfo updateInfo, AdapterBase fromAdapter, AdapterBase toAdapter) { if (updateInfo.Entry.Type == SyncEntryType.Directory) { await toAdapter.CreateItemAsync(updateInfo.Entry).ConfigureAwait(false); return; } FileCopyHelper fileCopyHelper = new FileCopyHelper( this.Relationship, fromAdapter, toAdapter, updateInfo, null, this.encryptionCertificate, this.CancellationToken, this.CopyProgressChanged); if (this.Relationship.EncryptionMode == EncryptionMode.Encrypt) { fileCopyHelper.EncryptionMode = EncryptionMode.Decrypt; } fileCopyHelper.UpdateSyncEntry = false; Logger.Debug("Creating item with content"); await fileCopyHelper.CopyFileAsync().ConfigureAwait(false); }
private void AddSyncEntriesRecursive( SyncDatabase db, List <EntryUpdateInfo> updatesToRestore, SyncEntry syncEntry, RestoreOnlyWindowsFileSystemAdapter destAdapter) { EntryUpdateInfo updateInfo = new EntryUpdateInfo( syncEntry, destAdapter, SyncEntryChangedFlags.Restored, syncEntry.GetRelativePath(db, "/")); updatesToRestore.Add(updateInfo); if (syncEntry.Type == SyncEntryType.Directory) { List <SyncEntry> childEntries = db.Entries.Where(e => e.ParentId == syncEntry.Id).ToList(); foreach (SyncEntry childEntry in childEntries) { this.AddSyncEntriesRecursive(db, updatesToRestore, childEntry, destAdapter); } } }
public FileCopyHelper( SyncRelationship relationship, AdapterBase fromAdapter, AdapterBase toAdapter, EntryUpdateInfo updateInfo, ThrottlingManager throttlingManager, X509Certificate2 encryptionCertificate, CancellationToken cancellationToken, Action <CopyProgressInfo> progressChanged) { this.fromAdapter = fromAdapter; this.toAdapter = toAdapter; this.updateInfo = updateInfo; this.throttlingManager = throttlingManager; this.encryptionCertificate = encryptionCertificate; this.cancellationToken = cancellationToken; this.progressChanged = progressChanged; this.EncryptionMode = relationship.EncryptionMode; this.UpdateSyncEntry = true; this.syncProgressUpdateStopwatch = new Stopwatch(); }
public CopyProgressInfo(long bytesCopied, EntryUpdateInfo entryUpdateInfo) { this.BytesCopied = bytesCopied; this.EntryUpdateInfo = entryUpdateInfo; }
public RestoreItemResult(EntryUpdateInfo info) { this.EntryUpdateInfo = info; }