我需要在我的C#应用程序中嵌入torrent客户端(通过.torrent文件下载文件的能力)。我正在使用monotorrent库来做到这一点。 我需要编写可以通过.torrent文件将文件下载到我的本地文件夹的Windows应用程序。
我从这里http://www.monotorrent.com/projects/list_files/monotorrent
下载了C#项目的程序集以下是我正在使用的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MonoTorrent.Client;
using MonoTorrent.Client.Encryption;
using System.IO;
using MonoTorrent.Common;
using System.Net;
namespace monotorrent
{
public partial class Form1 : Form
{
ClientEngine engine;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Torrent torrent = Torrent.Load("C:\\1.torrent");
// Create the manager which will download the torrent to savePath
// using the default settings.
TorrentManager manager = new TorrentManager(torrent, "E:\\torrent", new TorrentSettings());
// Register the manager with the engine
this.engine.Register(manager);
// Begin the download. It is not necessary to call HashCheck on the manager
// before starting the download. If a hash check has not been performed, the
// manager will enter the Hashing state and perform a hash check before it
// begins downloading.
// If the torrent is fully downloaded already, calling 'Start' will place
// the manager in the Seeding state.
manager.Start();
}
}
}
当我运行代码并按下载按钮时出现错误:
无法从程序集“monotorrent,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null”加载类型“MonoTorrent.Common.Torrent”。
我认为这是装配问题。但是我在哪里可以获得正常的汇编(.dll)?
请帮我解决此问题。
P.S。如果你知道更简单的解决方案将torrent客户端嵌入到Windows窗体应用程序 - 你很高兴=)