private Exception uploadArchive(ArchiveTransferManager manager, Archive arch, string basePath) { int rep = 0; Exception error = null; isDirty = true; do { if (rep > 0) { Thread.Sleep(2000); } try { DateTime start = DateTime.Now; arch.upload(manager, VaultName, basePath); UploadTime += DateTime.Now.Subtract(start); UploadBytes += arch.FileLength; if (!inventoryByPath.ContainsKey(arch.RelativePath)) { inventoryByPath[arch.RelativePath] = new List<Archive>(); } inventoryByPath[arch.RelativePath].Add(arch); inventoryById[arch.ArchiveId] = arch; toUpload.Remove(arch); } catch(Exception ex) { error = ex; } } while (++rep < 4 && error != null); return error; }