public void Execute(List <string> archivePaths) { try { NotifyAllGames(archivePaths); foreach (string archivePath in archivePaths) { string gameName = GetGameNameFromPath(archivePath); ILogEventEnricher[] properties = new ILogEventEnricher[] { new PropertyEnricher("ArchivePath", archivePath), new PropertyEnricher("Game", gameName) }; using (LogContext.Push(properties)) { _notifier.StartingGameUpload(gameName); try { Stopwatch uploadDuration = Stopwatch.StartNew(); var filesInArchive = GetAllFilesInArchive(gameName, archivePath); long totalSizeOfArchive = filesInArchive.Sum(x => x.UncompressedSize); var uploadResumeReport = CheckForResumeUpload(gameName, archivePath); long totalSizeFilesToUpload = uploadResumeReport.RemainingFiles.Sum(x => x.UncompressedSize); Log.ForContext("TotalUncompressedSize", totalSizeOfArchive) .ForContext("FilesToUploadUncompressedSize", totalSizeFilesToUpload) .Information("Calculated uncompressed size of files to upload"); // Only create the folder structure if we didn't find any files uploaded if (uploadResumeReport.SizeUploaded == 0) { CreateFolderStructure(gameName, archivePath); } else { _notifier.SkipCreateFolderStructure(gameName); } UploadAllFiles(gameName, uploadResumeReport); Log.ForContext("DurationMs", uploadDuration.ElapsedMilliseconds).Information("Upload finished"); _notifier.FinishedGameUpload(gameName, uploadDuration.Elapsed); } catch (Exception ex) { Log.Error(ex, "Unhandled exception occured while uploading archive."); _notifier.GameUploadError(gameName, ex, $"An unhandled exception occurred while uploading archive for {gameName}"); } } } } catch (Exception ex) { Log.Error(ex, "An unhandled exception occurred while uploading archives"); } ClearTemporaryFiles(); }