Проблема встраивания C # моноторрентного клиента - PullRequest
0 голосов
/ 16 июля 2011

Мне нужно встроить торрент-клиент (возможность загрузки файлов с помощью .torrent-файла) в мое приложение C #.Я использую моноторрентную библиотеку, чтобы сделать это.Мне нужно написать приложение для Windows, которое может загружать файлы в мою локальную папку с помощью .torrent-файла.

Я скачал сборку для проекта C # отсюда http://www.monotorrent.com/projects/list_files/monotorrent

Вот код, который я использую:

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.Common.Torrent" из сборки "monotorrent, Версия = 1.0.0.0, Culture = нейтральный, PublicKeyToken = null ".

Я думаю, что это проблема со сборкой.Но где я могу получить обычную сборку (.dll)?

Пожалуйста, помогите мне решить эту проблему.

PS Если вы знаете более простое решение для встраивания торрент-клиента в приложение Windows Form - выДобро пожаловать =)

Ответы [ 2 ]

0 голосов
/ 09 января 2013

Поместите ссылку на monotorrent.dll в ваш проект. Вы можете получить его здесь или скомпилировать из здесь

0 голосов
/ 20 июля 2011

Попробуйте скомпилировать библиотеку самостоятельно (открыв VS и выполнив сборку), вместо того, чтобы использовать какую-то библиотеку (* .dll), которую вы нашли где-то вне сети.Кроме того, все зависимости есть?

...