Пример #1
1
        public TrackerPeersAdded(TorrentManager manager, int peersAdded, int total, MonoTorrent.Client.Tracker.Tracker tracker)
            :base (manager, peersAdded, total)
        {
            if (tracker == null)
                throw new ArgumentNullException("tracker");

            this.tracker = tracker;
        }
Пример #2
0
        public byte[] Fetch(MonoTorrent.MagnetLink magnet)
        {
            string url = string.Format("http://torrage.com/torrent/{0}.torrent", magnet.InfoHash.ToHex());

            using (WebClient nc = new WebClient())
            {
                nc.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/18.0 (compatible; MSIE 10.0; Windows NT 5.2; .NET CLR 3.5.3705;)");

                byte[] gzip_data = null;

                try
                {
                    gzip_data = nc.DownloadData(url);
                }
                catch (WebException wex)
                {
                    if (wex.Message.Contains("404"))
                    {
                        return null;
                    }
                }
                catch (Exception) { return null; }

                if (gzip_data == null || gzip_data.Length == 0)
                    return null;

                byte[] data = Utility.DecompressGzip(gzip_data);

                return data;
            }
        }
Пример #3
0
        public BEncodedValue Handle(PeerDetails d, MonoTorrent.Common.TorrentEvent e, ITrackable trackable)
        {
            NameValueCollection c = new NameValueCollection();
            c.Add("info_hash", trackable.InfoHash.UrlEncode());
            c.Add("peer_id", d.peerId);
            c.Add("port", d.Port.ToString());
            c.Add("uploaded", d.Uploaded.ToString());
            c.Add("downloaded", d.Downloaded.ToString());
            c.Add("left", d.Remaining.ToString());
            c.Add("compact", "0");

            return base.Handle(c, d.ClientAddress, false);
        }
Пример #4
0
        public RssManagerController(MonoTorrent.Client.EngineSettings settings)
        {
            this.settings = settings;
            history = new List<Monsoon.RssItem>();
            feeds = new List<string>();
            filters = new List<Monsoon.RssFilter>();
            watchers = new Dictionary<string,Monsoon.TorrentRssWatcher>();
            items = new List<Monsoon.RssItem>();

            historyListStore = new Gtk.ListStore(typeof(RssItem));

            RestoreFeeds();
            RestoreHistory();
            RestoreFilters();

            RestoreWatchers();
            RefreshWatchers();
        }
Пример #5
0
 public override bool IsInteresting(MonoTorrent.Common.BitField bitfield)
 {
     return false;
 }
Пример #6
0
 public override void Initialise(MonoTorrent.Common.BitField bitfield, MonoTorrent.Common.TorrentFile[] files, IEnumerable<Piece> requests)
 {
     
 }
 protected override void HandleInterestedMessage(PeerId id, MonoTorrent.Client.Messages.Standard.InterestedMessage message)
 {
     // Nothing
 }
 protected override void HandleHaveNoneMessage(PeerId id, MonoTorrent.Client.Messages.FastPeer.HaveNoneMessage message)
 {
     // Nothing
 }
 protected override void HandleAllowedFastMessage(PeerId id, MonoTorrent.Client.Messages.FastPeer.AllowedFastMessage message)
 {
     // Disregard these when in metadata mode as we can't request regular pieces anyway
 }
Пример #10
0
		public override void HandlePeerConnected(PeerId id, MonoTorrent.Common.Direction direction)
		{
			id.CloseConnection();
		}
 public override bool IsInteresting(MonoTorrent.Common.BitField bitfield)
 {
     return ActivePicker.IsInteresting(bitfield);
 }
Пример #12
0
 public MagnetLinkNotification(EventType type, MonoTorrent.MagnetLink m)
     : this(type, m.Name, m.InfoHash.ToHex())
 {
 }
Пример #13
0
 public override void HandlePeerConnected(PeerId id, MonoTorrent.Common.Direction direction)
 {
     if (!ShouldConnect(id))
         id.CloseConnection();
     base.HandlePeerConnected(id, direction);
 }
Пример #14
0
 /// <summary>
 /// Converts MonoTorrent's torrent state into WebUI state.
 /// </summary>
 public static WebState StateAdapter(MonoTorrent.Common.TorrentState state)
 {
     if (state == TorrentState.Paused)
     {
         return WebState.Paused;
     }
     else if ((state == TorrentState.Hashing))
     {
         return WebState.Queued;
     }
     else if ((state == TorrentState.Downloading) || (state == TorrentState.Seeding))
     {
         return WebState.Active;
     }
     else
     {
         return WebState.Stopped;
     }
 }
Пример #15
0
 /// <summary>
 /// Converts priority from MonoTorrent to WebUI
 /// </summary>
 public static WebPriority PriorityAdapter(MonoTorrent.Common.Priority priority)
 {
     if (priority == Priority.DoNotDownload)
     {
         return WebPriority.Skip;
     }
     else if ((priority == Priority.Low) || (priority == Priority.Lowest))
     {
         return WebPriority.Low;
     }
     else if ((priority == Priority.High) || (priority == Priority.Highest) || (priority == Priority.Immediate))
     {
         return WebPriority.High;
     }
     else
     {
         return WebPriority.Normal;
     }
 }
Пример #16
0
 public TrackerAdapter(TorrentManager manager, MonoTorrent.Client.Tracker.Tracker tracker, ObjectPath path)
 {
     this.manager = manager;
     this.tracker = tracker;
     this.path = path;
 }