Пример #1
0
 /// <summary>
 /// Changes the position of the download denoted by <paramref name="gid"/> in the queue.
 /// </summary>
 /// <param name="gid">The GID of the download.</param>
 /// <param name="pos">The relative position to change.</param>
 /// <param name="how">The origin of the move.</param>
 /// <returns>The resulting position.</returns>
 public Task <int> ChangePositionAsync(Aria2GID gid, int pos, ChangePositionOrigin how)
 => DoRpcAsync(new ChangePositionRequest
 {
     Gid = gid,
     Pos = pos,
     How = how
 });
 public DownloadProgressStatus(
     Aria2GID gid, DownloadStatus status, long totalLength, long completedLength, long uploadedLength,
     BitArray?bitfield, int downloadSpeed, int uploadSpeed, string?infoHash, int numSeeders, bool seeder,
     long pieceLength, int numPieces, int connections, int errorCode, string?errorMessage,
     IReadOnlyList <Aria2GID>?followedBy, Aria2GID?following, Aria2GID?belongsTo, string?dir,
     IReadOnlyList <DownloadFileStatus>?files, BitTorrentDownloadInfo?bitTorrent, long?verifiedLength,
     bool verifyIntegrityPending)
 {
     Gid                    = gid;
     Status                 = status;
     TotalLength            = totalLength;
     CompletedLength        = completedLength;
     UploadedLength         = uploadedLength;
     Bitfield               = bitfield;
     DownloadSpeed          = downloadSpeed;
     UploadSpeed            = uploadSpeed;
     InfoHash               = infoHash;
     NumSeeders             = numSeeders;
     Seeder                 = seeder;
     PieceLength            = pieceLength;
     NumPieces              = numPieces;
     Connections            = connections;
     ErrorCode              = errorCode;
     ErrorMessage           = errorMessage;
     FollowedBy             = followedBy;
     Following              = following;
     BelongsTo              = belongsTo;
     Dir                    = dir;
     Files                  = files;
     BitTorrent             = bitTorrent;
     VerifiedLength         = verifiedLength;
     VerifyIntegrityPending = verifyIntegrityPending;
 }
Пример #3
0
 public Aria2Task(Aria2Connection connection, Aria2GID gid, Aria2Task?following = null)
 {
     _connection = connection;
     GID         = gid;
     Following   = following;
 }
Пример #4
0
 /// <summary>
 /// Change uris of the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <remarks>
 /// The method first executes deletion then addition when calculating <paramref name="position"/>.
 /// </remarks>
 /// <param name="gid">The GID of the download.</param>
 /// <param name="fileIndex">1-based index to select the file in the download.</param>
 /// <param name="delUris">The uris to remove from the list.</param>
 /// <param name="addUris">The uris to add into the list.</param>
 /// <param name="position">The position new uris to add to.
 /// If <see langword="null"/>, appended at the end.</param>
 /// <returns></returns>
 public Task <(int numDeleted, int numAdded)> ChangeUriAsync(
     Aria2GID gid, int fileIndex = 0,
     string[]?delUris            = null, string[]?addUris = null,
     int?position = null)
 => DoRpcAsync(new ChangeUriRequest
Пример #5
0
 /// <summary>
 /// Gets currently connected HTTP(S)/FTP/SFTP servers of the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <param name="gid">The GID of the download.</param>
 /// <returns>Connected servers of the download.</returns>
 public Task <DownloadServerInfoOfFile[]> GetServersAsync(Aria2GID gid)
 => DoRpcAsync(new GetServersRequest
 {
     Gid = gid
 });
Пример #6
0
 /// <summary>
 /// Gets a list peers of the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <remarks>
 /// This method is for BitTorrent only.
 /// </remarks>
 /// <param name="gid">The GID of the download.</param>
 /// <returns>Peers of the download.</returns>
 public Task <PeerInfo[]> GetPeersAsync(Aria2GID gid)
 => DoRpcAsync(new GetPeersRequest
 {
     Gid = gid
 });
Пример #7
0
 /// <summary>
 /// Gets the files in the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <param name="gid">The GID of the download.</param>
 /// <returns>Files and status in the download.</returns>
 public Task <DownloadFileStatus[]> GetFilesAsync(Aria2GID gid)
 => DoRpcAsync(new GetFilesRequest
 {
     Gid = gid
 });
Пример #8
0
 /// <summary>
 /// Gets the URIs used in the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <param name="gid">The GID of the download.</param>
 /// <returns>Uris used by the download. Corresponding to uris in <see cref="AddUriAsync(string[])"/>.</returns>
 public Task <FileDownloadUriInfo[]> GetUrisAsync(Aria2GID gid)
 => DoRpcAsync(new GetUrisRequest
 {
     Gid = gid
 });
Пример #9
0
 /// <summary>
 /// Gets the progress of the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <param name="gid">The GID of the download.</param>
 /// <param name="keys">Limits keys of information to query.
 /// If null or empty, the response will contain all keys.</param>
 /// <returns>The status of queried download.</returns>
 public Task <DownloadProgressStatus> TellStatusAsync(Aria2GID gid, string[]?keys = null)
 => DoRpcAsync(new TellStatusRequest
 {
     Gid  = gid,
     Keys = keys
 });
Пример #10
0
 /// <summary>
 /// Unpauses the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <remarks>
 /// This method changes the status of the download denoted by <paramref name="gid"/>
 /// from <see cref="DownloadStatus.Paused"/> to <see cref="DownloadStatus.Waiting"/>,
 /// making the download eligible to be restarted.
 /// </remarks>
 /// <param name="gid">The gid of download to unpause.</param>
 /// <returns>GID of unpaused download.</returns>
 public Task <Aria2GID> UnpauseAsync(Aria2GID gid)
 => DoRpcAsync(new UnpauseRequest
 {
     Gid = gid
 });
Пример #11
0
 /// <summary>
 /// Force pauses the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <remarks>
 /// This method behaves just like <see cref="PauseAsync(Aria2GID)"/>
 /// except that this method pauses the download without performing any actions which take time.
 /// </remarks>
 /// <param name="gid">The gid of download to pause.</param>
 /// <returns>GID of paused download.</returns>
 /// <seealso cref="PauseAsync(Aria2GID)"/>
 public Task <Aria2GID> ForcePauseAsync(Aria2GID gid)
 => DoRpcAsync(new ForcePauseRequest
 {
     Gid = gid
 });
Пример #12
0
 /// <summary>
 /// Removes the download denoted by <paramref name="gid"/>.
 /// </summary>
 /// <remarks>
 /// If the specified download is in progress, it is first stopped.
 /// The status of the removed download becomes <see cref="DownloadStatus.Removed"/>.
 /// </remarks>
 /// <param name="gid">The gid of download to remove.</param>
 /// <returns>GID of removed download.</returns>
 public Task <Aria2GID> RemoveAsync(Aria2GID gid)
 => DoRpcAsync(new RemoveRequest
 {
     Gid = gid
 });