/// <summary> /// Removes all of the finished torrents from uTorrent /// </summary> /// <param name="removalOptions">the removal options to use</param> public void RemoveFinished(TorrentRemovalOptions removalOptions = TorrentRemovalOptions.TorrentFile) { for (int x = 0; x < this.internalCollection.Count;) { Torrent t = this.internalCollection[x]; if (t.Status == TorrentStatus.FinishedOrStopped && t.ProgressInMils == 1000) { this.Remove(t, removalOptions); } else { x++; } } }
/// <summary> /// Removes the specified torrent from uTorrent /// </summary> /// <param name="torrentHash">the torrent to remove</param> /// <param name="removalOptions">the removal options to use</param> public void Remove(string torrentHash, TorrentRemovalOptions removalOptions = TorrentRemovalOptions.TorrentFile) { switch (removalOptions) { case TorrentRemovalOptions.Job: this.proxy.Remove(torrentHash); break; case TorrentRemovalOptions.Data: this.proxy.RemoveData(torrentHash); break; case TorrentRemovalOptions.TorrentFile: this.proxy.RemoveTorrent(torrentHash); break; case TorrentRemovalOptions.TorrentFileAndData: this.proxy.RemoveTorrentAndData(torrentHash); break; default: throw new InvalidOperationException("Invalid removalOptions supplied."); } }
/// <summary> /// Removes the torrent at the specified index from uTorrent (torrent file only). /// </summary> /// <param name="index">the index of the torrent to remove</param> /// <param name="removalOptions">the removal options to use</param> public void RemoveAt(int index, TorrentRemovalOptions removalOptions = TorrentRemovalOptions.TorrentFile) { this.Remove(this.internalCollection[index].Hash, removalOptions); }
/// <summary> /// Removes the specified torrent from uTorrent /// </summary> /// <param name="torrent">the torrent to remove</param> /// <param name="removalOptions">the removal options to use</param> /// <returns>value is unused--it is always true</returns> public bool Remove(Torrent torrent, TorrentRemovalOptions removalOptions = TorrentRemovalOptions.TorrentFile) { this.Remove(torrent.Hash, removalOptions); return(true); }