我需要在我的C#应用程序中嵌入torrent客户端(通过.torrent文件下载文件的能力)。我正在使用monotorrent库来做到这一点。我需要写windows应用程序,可以下载文件到我的本地文件夹的.torrent文件。
我已经从这里的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();
}
}
}当我运行代码并按下download按钮时,我得到一个错误:
无法从程序集"monotorrent,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null“加载类型"MonoTorrent.Common.Torrent”。
我认为这是组装的问题。但是我在哪里可以得到一个普通的程序集(.dll)呢?
请帮我解决这个问题。
附注:如果您知道更简单的解决方案,将torrent客户端嵌入到windows窗体应用程序中-您就是wellcome =)
https://stackoverflow.com/questions/6717722
复制相似问题