Click here to Skip to main content
15,074,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.
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 =)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900