Author: alanmc
Date: 2008-02-14 16:12:04 -0500 (Thu, 14 Feb 2008)
New Revision: 95698
Modified:
trunk/bitsharp/src/SampleClient/TestManualConnection.cs
Log:
Enhanced the TestRig
Modified: trunk/bitsharp/src/SampleClient/TestManualConnection.cs
===================================================================
--- trunk/bitsharp/src/SampleClient/TestManualConnection.cs 2008-02-14
21:10:35 UTC (rev 95697)
+++ trunk/bitsharp/src/SampleClient/TestManualConnection.cs 2008-02-14
21:12:04 UTC (rev 95698)
@@ -141,10 +141,16 @@
}
public EngineTestRig(string savePath)
+ : this(savePath, 256 * 1024)
{
+
+ }
+
+ public EngineTestRig(string savePath, int piecelength)
+ {
listener = new CustomListener();
engine = new ClientEngine(new EngineSettings(), listener);
- torrent = Torrent.Load(CreateTorrent());
+ torrent = Torrent.Load(CreateTorrent(piecelength));
manager = new TorrentManager(torrent, savePath, new
TorrentSettings());
engine.Register(manager);
manager.Start();
@@ -155,10 +161,10 @@
listener.Add(manager, connection);
}
- private static BEncodedDictionary CreateTorrent()
+ private static BEncodedDictionary CreateTorrent(int pieceLength)
{
BEncodedDictionary infoDict = new BEncodedDictionary();
- infoDict[new BEncodedString("piece length")] = new
BEncodedNumber(256 * 1024);
+ infoDict[new BEncodedString("piece length")] = new
BEncodedNumber(pieceLength);
infoDict[new BEncodedString("pieces")] = new BEncodedString(new
byte[20 * 15]);
infoDict[new BEncodedString("length")] = new BEncodedNumber(15 *
256 * 1024 - 1);
infoDict[new BEncodedString("name")] = new
BEncodedString("test.files");
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches