public InfoHashTrackable(System.Net.BitTorrent.Common.Torrent torrent)
        {
            Check.Torrent(torrent);

            name     = torrent.Name;
            infoHash = torrent.InfoHash;
        }
        public bool Contains(System.Net.BitTorrent.Common.Torrent torrent)
        {
            CheckDisposed();
            if (torrent == null)
            {
                return(false);
            }

            return(Contains(torrent.InfoHash));
        }
        /// <summary>
        /// Creates a new TorrentManager instance.
        /// </summary>
        /// <param name="torrent">The torrent to load in</param>
        /// <param name="savePath">The directory to save downloaded files to</param>
        /// <param name="settings">The settings to use for controlling connections</param>
        /// <param name="baseDirectory">In the case of a multi-file torrent, the name of the base directory containing the files. Defaults to Torrent.Name</param>
        public TorrentManager(System.Net.BitTorrent.Common.Torrent torrent, string savePath, TorrentSettings settings, string baseDirectory)
        {
            Check.Torrent(torrent);
            Check.SavePath(savePath);
            Check.Settings(settings);
            Check.BaseDirectory(baseDirectory);

            this.torrent  = torrent;
            this.infohash = torrent.infoHash;
            this.settings = settings;

            Initialise(savePath, baseDirectory, torrent.AnnounceUrls);
            ChangePicker(CreateStandardPicker());
        }
 private void SwitchToRegular()
 {
     System.Net.BitTorrent.Common.Torrent torrent = Manager.Torrent;
     foreach (PeerId peer in Manager.Peers.ConnectedPeers)
     {
         peer.CloseConnection();
     }
     Manager.Bitfield = new BitField(torrent.Pieces.Count);
     Manager.PieceManager.ChangePicker(Manager.CreateStandardPicker(), Manager.Bitfield, torrent.Files);
     foreach (TorrentFile file in torrent.Files)
     {
         file.FullPath = Path.Combine(Manager.SavePath, file.Path);
     }
     Manager.Start();
 }
Пример #5
0
 public TorrentEditor(System.Net.BitTorrent.Common.Torrent torrent)
     : base(torrent)
 {
 }
 /// <summary>
 /// Creates a new TorrentManager instance.
 /// </summary>
 /// <param name="torrent">The torrent to load in</param>
 /// <param name="savePath">The directory to save downloaded files to</param>
 /// <param name="settings">The settings to use for controlling connections</param>
 public TorrentManager(System.Net.BitTorrent.Common.Torrent torrent, string savePath, TorrentSettings settings)
     : this(torrent, savePath, settings, torrent.Files.Length == 1 ? "" : torrent.Name)
 {
 }
Пример #7
0
 public EditableTorrent(System.Net.BitTorrent.Common.Torrent torrent)
 {
     Check.Torrent(torrent);
     Initialise(torrent.ToDictionary());
 }