public void Update(TorrentData td) { this.torrentProgress = td.torrentProgress; this.downSpeed = td.DownloadSpeed; this.upSpeed = td.upSpeed; this.eta = td.eta; this.peers = td.peers; this.seeds = td.seeds; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("TorrentProgress")); PropertyChanged(this, new PropertyChangedEventArgs("DownloadSpeed")); PropertyChanged(this, new PropertyChangedEventArgs("UploadSpeed")); PropertyChanged(this, new PropertyChangedEventArgs("ETA")); } }
private void TorrentReceived(TorrentInfo ti) { TorrentData td = new TorrentData(ti); int i; lock (torrents) { for (i = 0; i < torrents.Count; i++) { if (torrents[i].EqualsTorrent(td)) { torrents[i].Update(td); break; } } if (i == torrents.Count) AddTorrent(td); } }
public void AddTorrent(TorrentData torrent) { torrents.Add(torrent); }