Skip to content

Commit

Permalink
Fix some formatting strings to prevent exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcgovern committed Sep 11, 2024
1 parent e41e931 commit e443c6c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Samples/SampleClient/StandardDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e443c6c

Please sign in to comment.