From e95600a4167d6f0b6d6a7dc7e44b163424f13637 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 22 Oct 2024 15:32:55 +0100 Subject: [PATCH] format --- .../Operations/PassthroughProgress.cs | 1 - .../Operations/ProgressDisplayManager.cs | 10 +++++--- .../Operations/ReceiveOperation.cs | 24 +++++++++---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Sdk/Speckle.Connectors.Common/Operations/PassthroughProgress.cs b/Sdk/Speckle.Connectors.Common/Operations/PassthroughProgress.cs index 6c21be88..265c9554 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/PassthroughProgress.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/PassthroughProgress.cs @@ -31,7 +31,6 @@ public void Report(ProgressArgs value) } else { - _progressCallback(value); } } diff --git a/Sdk/Speckle.Connectors.Common/Operations/ProgressDisplayManager.cs b/Sdk/Speckle.Connectors.Common/Operations/ProgressDisplayManager.cs index f0409ef7..639194f5 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/ProgressDisplayManager.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/ProgressDisplayManager.cs @@ -12,7 +12,11 @@ public class ProgressDisplayManager(IStopwatchManager stopwatch) : IProgressDisp public void Begin() => stopwatch.Start(); private long _lastCount; - public long LastCount { get => _lastCount; set => _lastCount = value; } + public long LastCount + { + get => _lastCount; + set => _lastCount = value; + } public bool ShouldUpdate() { @@ -51,8 +55,8 @@ public string CalculateSpeed(ProgressArgs args) return $"{ToFileSize(countPerSecond)} / sec"; case ProgressEvent.DeserializeObject: case ProgressEvent.SerializeObject: - case ProgressEvent.DownloadObject: - case ProgressEvent.UploadObject: + case ProgressEvent.DownloadObject: + case ProgressEvent.UploadObject: return $"{ThreeNonZeroDigits(countPerSecond)} objects / sec"; default: return string.Empty; diff --git a/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs b/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs index e304561f..f3e87a85 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs @@ -59,7 +59,9 @@ CancellationToken cancellationToken _progressDisplayManager.Begin(); Base? commitObject = await _operations - .Receive2(new Uri(account.serverInfo.url), receiveInfo.ProjectId, + .Receive2( + new Uri(account.serverInfo.url), + receiveInfo.ProjectId, version.referencedObject, account.token, onProgressAction: new PassthroughProgress(args => @@ -71,26 +73,22 @@ CancellationToken cancellationToken switch (args.ProgressEvent) { - case ProgressEvent.CacheCheck: + case ProgressEvent.CacheCheck: onOperationProgressed.Report( - new( - "Checking local cache", - _progressDisplayManager.CalculatePercentage(args) - ) + new("Checking local cache", _progressDisplayManager.CalculatePercentage(args)) ); break; - case ProgressEvent.DownloadBytes: + case ProgressEvent.DownloadBytes: + onOperationProgressed.Report(new($"Downloading ({_progressDisplayManager.CalculateSpeed(args)})", null)); + break; + case ProgressEvent.DownloadObject: onOperationProgressed.Report( new( - $"Downloading ({_progressDisplayManager.CalculateSpeed(args)})", null + $"Downloading Objects ({_progressDisplayManager.CalculateSpeed(args)})", + _progressDisplayManager.CalculatePercentage(args) ) ); break; - case ProgressEvent.DownloadObject: - onOperationProgressed.Report(new( - $"Downloading Objects ({_progressDisplayManager.CalculateSpeed(args)})", - _progressDisplayManager.CalculatePercentage(args))); - break; case ProgressEvent.DeserializeObject: onOperationProgressed.Report( new(