From e443c6cd39030c0d6c3f3ee95c8da284e9756848 Mon Sep 17 00:00:00 2001 From: Alan McGovern Date: Wed, 11 Sep 2024 06:13:40 +0100 Subject: [PATCH] Fix some formatting strings to prevent exceptions --- src/Samples/SampleClient/StandardDownloader.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Samples/SampleClient/StandardDownloader.cs b/src/Samples/SampleClient/StandardDownloader.cs index 408fcc9f0..ae3e8898c 100644 --- a/src/Samples/SampleClient/StandardDownloader.cs +++ b/src/Samples/SampleClient/StandardDownloader.cs @@ -145,20 +145,12 @@ public async Task DownloadAsync (CancellationToken token) var peers = await manager.GetPeersAsync (); AppendFormat (sb, "Outgoing:"); foreach (PeerId p in peers.Where (t => t.ConnectionDirection == Direction.Outgoing)) { - AppendFormat (sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0} - {4} ({5})", p.Uri, - p.Monitor.DownloadRate / 1024.0, - p.AmRequestingPiecesCount, - p.Monitor.UploadRate / 1024.0, - p.EncryptionType); + AppendFormat (sb, $"\t{p.AmRequestingPiecesCount} - {(p.Monitor.DownloadRate / 1024.0):0.00}/{(p.Monitor.UploadRate / 1024.0):0.00}kB/sec - {p.Uri} - {p.EncryptionType}"); } AppendFormat (sb, ""); AppendFormat (sb, "Incoming:"); foreach (PeerId p in peers.Where (t => t.ConnectionDirection == Direction.Incoming)) { - AppendFormat (sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0} - {4} ({5})", p.Uri, - p.Monitor.DownloadRate / 1024.0, - p.AmRequestingPiecesCount, - p.Monitor.UploadRate / 1024.0, - p.EncryptionType); + AppendFormat (sb, $"\t{p.AmRequestingPiecesCount} - {(p.Monitor.DownloadRate / 1024.0):0.00}/{(p.Monitor.UploadRate / 1024.0):0.00}kB/sec - {p.Uri} - {p.EncryptionType}"); } AppendFormat (sb, "", null);