alanmcgovern / monotorrent

The official repository for MonoTorrent, a bittorrent library for .NET

Home Page:https://github.com/alanmcgovern/monotorrent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot instantiate TorrentManager outside of the library

DenislavLitsov opened this issue · comments

I get error when I try to do this:
TorrentManager manager = new TorrentManager(engine, torrent, this.fileService.GetContent(), new TorrentSettings());

Because the TorrentManager has only private and internal constructors

Why do you want to manually create a new TorrentManager? As far as I can see it's useless without a client. You're supposed to first create ClientEngine and then use AddAsync on it to create a new instance of TorrentManager. Check the sample projects included in the repo for details.

Yup, exactly!

If you create a ClientEngine and call "ClientEngine.AddAsync" you should be good to go!

In much much older versions of the library you were supposed to create this manually, but the new approach allows for a nice simplification for things like fetching metadata from other peers, and automatically saving/restoring it later.