Skip to content

Commit e443c6c

Browse files
committed
Fix some formatting strings to prevent exceptions
1 parent e41e931 commit e443c6c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Samples/SampleClient/StandardDownloader.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,12 @@ public async Task DownloadAsync (CancellationToken token)
145145
var peers = await manager.GetPeersAsync ();
146146
AppendFormat (sb, "Outgoing:");
147147
foreach (PeerId p in peers.Where (t => t.ConnectionDirection == Direction.Outgoing)) {
148-
AppendFormat (sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0} - {4} ({5})", p.Uri,
149-
p.Monitor.DownloadRate / 1024.0,
150-
p.AmRequestingPiecesCount,
151-
p.Monitor.UploadRate / 1024.0,
152-
p.EncryptionType);
148+
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}");
153149
}
154150
AppendFormat (sb, "");
155151
AppendFormat (sb, "Incoming:");
156152
foreach (PeerId p in peers.Where (t => t.ConnectionDirection == Direction.Incoming)) {
157-
AppendFormat (sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0} - {4} ({5})", p.Uri,
158-
p.Monitor.DownloadRate / 1024.0,
159-
p.AmRequestingPiecesCount,
160-
p.Monitor.UploadRate / 1024.0,
161-
p.EncryptionType);
153+
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}");
162154
}
163155

164156
AppendFormat (sb, "", null);

0 commit comments

Comments
 (0)