public static void TestDownloadFile(string db, string torrentPath, string savePath)
        {
            //System.Diagnostics.Debugger.Launch();
            var dbs            = new ChunkDbService(db, false);
            var ds             = new DeduplicationService(dbs);
            var writer         = new DedupDiskWriter(ds);
            var engineSettings = new EngineSettings();

            engineSettings.PreferEncryption  = false;
            engineSettings.AllowedEncryption = EncryptionTypes.All;
            int port = 33123;
            var ip   = NetUtil.GetLocalIPByInterface("Local Area Connection");

            engineSettings.ReportedAddress = new IPEndPoint(ip, port);
            var engine  = new ClientEngine(engineSettings, new DedupDiskWriter(ds));
            var vd      = new VirtualDiskDownloadService(engine, new FileInfoTable <TorrentManager>());
            var torrent = Torrent.Load(torrentPath);

            logger.DebugFormat("Loaded torrent file: {0}, piece length: {1}.",
                               torrent.Name, torrent.PieceLength);
            var filePath = Path.Combine(savePath, torrent.Name);

            vd.StartDownloadingFile(torrent, savePath, dbs.GetManagedFile(filePath).ChunkMap.LastPieceInProfile);
            Console.Read();
        }
 public static void TestDownloadFile(string db, string torrentPath, string savePath)
 {
     //System.Diagnostics.Debugger.Launch();
     var dbs = new ChunkDbService(db, false);
     var ds = new DeduplicationService(dbs);
     var writer = new DedupDiskWriter(ds);
     var engineSettings = new EngineSettings();
     engineSettings.PreferEncryption = false;
     engineSettings.AllowedEncryption = EncryptionTypes.All;
     int port = 33123;
     var ip = NetUtil.GetLocalIPByInterface("Local Area Connection");
     engineSettings.ReportedAddress = new IPEndPoint(ip, port);
     var engine = new ClientEngine(engineSettings, new DedupDiskWriter(ds));
     var vd = new VirtualDiskDownloadService(engine, new FileInfoTable<TorrentManager>());
     var torrent = Torrent.Load(torrentPath);
     logger.DebugFormat("Loaded torrent file: {0}, piece length: {1}.",
         torrent.Name, torrent.PieceLength);
     var filePath = Path.Combine(savePath, torrent.Name);
     vd.StartDownloadingFile(torrent, savePath, dbs.GetManagedFile(filePath).ChunkMap.LastPieceInProfile);
     Console.Read();
 }