Reputation: 1
I need to embed torrent client (ability to download files by .torrent file) inside of my C# application. I am using monotorrent library to do that. I need to write windows app that can download files to my local folder by .torrent file.
I have downloaded assembly for C# project from here http://www.monotorrent.com/projects/list_files/monotorrent
Here is code i am using :
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();
}
}
}
When i run the code and press download button i have got an error :
Cannot load type "MonoTorrent.Common.Torrent" from assembly "monotorrent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null".
I think this is a problem with assembly . But where can i get a normal assembly(.dll) ?
Please help me to resolve this issue.
P.S. if you know more simple solution to embed torrent client to windows form app - You are wellcome =)
Upvotes: 0
Views: 2477
Reputation: 46
Place reference to monotorrent.dll in your project. You can get it here or compile from sources from here
Upvotes: 0
Reputation: 7672
Try compiling the library yourself (by opening VS and doing a build) rather than using some lib (*.dll) you've found somewhere off the net. Also, are all the dependencies there?
Upvotes: 0