首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >C# monotorrent客户端嵌入问题

C# monotorrent客户端嵌入问题
EN

Stack Overflow用户
提问于 2011-07-16 21:36:52
回答 2查看 2.4K关注 0票数 0

我需要在我的C#应用程序中嵌入torrent客户端(通过.torrent文件下载文件的能力)。我正在使用monotorrent库来做到这一点。我需要写windows应用程序,可以下载文件到我的本地文件夹的.torrent文件。

我已经从这里的http://www.monotorrent.com/projects/list_files/monotorrent下载了C#项目的程序集

下面是我使用的代码:

代码语言:javascript
复制
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 =)

EN

回答 2

Stack Overflow用户

发布于 2011-07-20 06:37:38

尝试自己编译库(通过打开VS并进行构建),而不是使用您在网上找到的某个库(*.dll)。另外,所有的依赖项都在那里吗?

票数 0
EN

Stack Overflow用户

发布于 2013-01-09 19:47:31

在项目中放置对monotorrent.dll的引用。您可以从here的源代码中获取here或进行编译

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6717722

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档