Class TorrentManager
Inheritance
System.Object
TorrentManager
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: MonoTorrent.dll
Syntax
public class TorrentManager : IEquatable<TorrentManager>, ITorrentData
Properties
Bitfield
Declaration
public BitField Bitfield { get; }
Property Value
CanUseDht
Declaration
public bool CanUseDht { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
CanUseLocalPeerDiscovery
Declaration
public bool CanUseLocalPeerDiscovery { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Complete
Returns true only when all files have been fully downloaded. If some files are marked as 'DoNotDownload' then the
torrent will not be considered to be Complete until they are downloaded.
Declaration
public bool Complete { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Engine
Declaration
public ClientEngine Engine { get; }
Property Value
Error
Declaration
public Error Error { get; }
Property Value
Files
Declaration
public IList<ITorrentFileInfo> Files { get; }
Property Value
HashChecked
Declaration
public bool HashChecked { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
HashFails
Declaration
public int HashFails { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Declaration
public bool HasMetadata { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
InfoHash
Declaration
public InfoHash InfoHash { get; }
Property Value
IsInEndGame
True if this torrent has activated special processing for the final few pieces
Declaration
public bool IsInEndGame { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsInitialSeeding
Declaration
public bool IsInitialSeeding { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
LastDhtAnnounce
The time the last announce to the DHT occurred
Declaration
public DateTime LastDhtAnnounce { get; }
Property Value
| Type |
Description |
| System.DateTime |
|
LastLocalPeerAnnounce
The time the last announce using Local Peer Discovery occurred
Declaration
public DateTime LastLocalPeerAnnounce { get; }
Property Value
| Type |
Description |
| System.DateTime |
|
MagnetLink
Declaration
public MagnetLink MagnetLink { get; }
Property Value
The path to the .torrent metadata used to create the TorrentManager. Typically stored within the MetadataCacheDirectory directory.
Declaration
public string MetadataPath { get; }
Property Value
| Type |
Description |
| System.String |
|
Monitor
Declaration
public ConnectionMonitor Monitor { get; }
Property Value
OpenConnections
The number of peers that this torrent instance is connected to
Declaration
public int OpenConnections { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
PartialProgress
The download progress in percent (0 -> 100.0) for the files whose priority
is not set to DoNotDownload. If every file is marked
as DoNotDownload then this returns 0. If no file is
marked as 'DoNotDownload' then this returns the same value as Progress.
Declaration
public double PartialProgress { get; }
Property Value
| Type |
Description |
| System.Double |
|
Peers
Declaration
public PeerManager Peers { get; }
Property Value
PieceLength
Declaration
public int PieceLength { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
PieceManager
The piecemanager for this TorrentManager
Declaration
public PieceManager PieceManager { get; }
Property Value
Progress
The download progress in percent (0 -> 100.0). This includes all files, even
if they are marked as DoNotDownload. This will return
'100.0' when all files in the torrent have been downloaded.
Declaration
public double Progress { get; }
Property Value
| Type |
Description |
| System.Double |
|
SavePath
The directory to download the files to
Declaration
public string SavePath { get; }
Property Value
| Type |
Description |
| System.String |
|
Settings
The settings for with this TorrentManager
Declaration
public TorrentSettings Settings { get; }
Property Value
Size
Declaration
public long Size { get; }
Property Value
| Type |
Description |
| System.Int64 |
|
StartTime
The time the torrent manager was started at
Declaration
public DateTime StartTime { get; }
Property Value
| Type |
Description |
| System.DateTime |
|
State
The current state of the TorrentManager
Declaration
public TorrentState State { get; }
Property Value
StreamProvider
When a Torrent or MagnetLink has been added using
the 'AddStreamingAsync' methods on ClientEngine then this property
will be non-null and streams can be created to access any of the files in the
torrent while they are downloading. These streams are fully seekable, and if you
seek to a position which has not been downloaded already the required pieces will
be prioritised next.
Declaration
public StreamProvider StreamProvider { get; }
Property Value
Torrent
The Torrent contained within this TorrentManager
Declaration
public Torrent Torrent { get; }
Property Value
TrackerManager
The tracker connection associated with this TorrentManager
Declaration
public ITrackerManager TrackerManager { get; }
Property Value
UploadingTo
The number of peers that we are currently uploading to
Declaration
public int UploadingTo { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Methods
AddPeerAsync(Peer)
Declaration
public Task<bool> AddPeerAsync(Peer peer)
Parameters
| Type |
Name |
Description |
| Peer |
peer |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<System.Boolean> |
|
AddPeersAsync(IEnumerable<Peer>)
Declaration
public Task<int> AddPeersAsync(IEnumerable<Peer> peers)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<Peer> |
peers |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<System.Int32> |
|
ChangePickerAsync(IPieceRequester)
Changes the active piece picker. This can be called when the manager is running, or when it is stopped.
Declaration
public Task ChangePickerAsync(IPieceRequester requester)
Parameters
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
DhtAnnounceAsync()
Perform an announce using the DhtEngine to retrieve more peers. The
returned task completes as soon as the Dht announce begins.
Declaration
public Task DhtAnnounceAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Equals(TorrentManager)
Declaration
public bool Equals(TorrentManager other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.Object.GetHashCode()
GetPeersAsync()
Declaration
public Task<List<PeerId>> GetPeersAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task<System.Collections.Generic.List<PeerId>> |
|
HashCheckAsync(Boolean)
Performs a full hash check, ignoring any previously loaded Fast Resume data or previous hash checks.
Declaration
public Task HashCheckAsync(bool autoStart)
Parameters
| Type |
Name |
Description |
| System.Boolean |
autoStart |
True if a the TorrentManager should be started as soon as the hashcheck completes.
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
LoadFastResume(FastResume)
Declaration
public void LoadFastResume(FastResume data)
Parameters
LocalPeerAnnounceAsync()
Declaration
public Task LocalPeerAnnounceAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
MoveFileAsync(ITorrentFileInfo, String)
Declaration
public Task MoveFileAsync(ITorrentFileInfo file, string path)
Parameters
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
MoveFilesAsync(String, Boolean)
Declaration
public Task MoveFilesAsync(string newRoot, bool overWriteExisting)
Parameters
| Type |
Name |
Description |
| System.String |
newRoot |
|
| System.Boolean |
overWriteExisting |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
PauseAsync()
Pauses the TorrentManager
Declaration
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
SaveFastResume()
Declaration
public FastResume SaveFastResume()
Returns
SetFilePriorityAsync(ITorrentFileInfo, Priority)
Declaration
public Task SetFilePriorityAsync(ITorrentFileInfo file, Priority priority)
Parameters
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
SetNeedsHashCheckAsync()
Declaration
public Task SetNeedsHashCheckAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
StartAsync()
Starts the TorrentManager
Declaration
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
StopAsync()
Stops the TorrentManager. The returned task completes as soon as the manager has fully stopped.
Declaration
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
StopAsync(TimeSpan)
Stops the TorrentManager. The returned task completes as soon as the manager has fully stopped. The final
tracker announce will be limited to the maximum of either 2 seconds or timeout seconds.
Declaration
public Task StopAsync(TimeSpan timeout)
Parameters
| Type |
Name |
Description |
| System.TimeSpan |
timeout |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
ToString()
Overrridden. Returns the name of the torrent.
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
UpdateSettingsAsync(TorrentSettings)
Declaration
public Task UpdateSettingsAsync(TorrentSettings settings)
Parameters
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Waits for the metadata to be available
Declaration
public Task WaitForMetadataAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Declaration
public Task WaitForMetadataAsync(CancellationToken token)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
token |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Events
ConnectionAttemptFailed
This asynchronous event is raised when an outgoing connection to a peer
could not be established.
Declaration
public event EventHandler<ConnectionAttemptFailedEventArgs> ConnectionAttemptFailed
Event Type
PeerConnected
This asynchronous event is raised whenever a new incoming, or outgoing, connection
has successfully completed the handshake process and has been fully established.
Declaration
public event EventHandler<PeerConnectedEventArgs> PeerConnected
Event Type
PeerDisconnected
This asynchronous event is raised whenever an established connection has been
closed.
Declaration
public event EventHandler<PeerDisconnectedEventArgs> PeerDisconnected
Event Type
PeersFound
Declaration
public event EventHandler<PeersAddedEventArgs> PeersFound
Event Type
PieceHashed
This asynchronous event is raised whenever a piece is hashed, either as part of
regular downloading, or as part of a HashCheckAsync(Boolean).
Declaration
public event EventHandler<PieceHashedEventArgs> PieceHashed
Event Type
TorrentStateChanged
This asynchronous event is raised whenever the TorrentManager changes state.
Declaration
public event EventHandler<TorrentStateChangedEventArgs> TorrentStateChanged
Event Type
Implements
System.IEquatable<T>
Extension Methods