コード例 #1
0
		/// <summary>Gets information about the current transfer status.</summary>
		/// <param name="token">The transfer to check.</param>
		/// <returns>Returns an information object or <code>null</code> when not available.</returns>
		public R<FileTransfer, CommandError> GetStats(FileTransferToken token)
		{
			lock (token)
			{
				if (token.Status != TransferStatus.Transfering)
					return Util.CustomError("No transfer found");
			}
			var result = parent.FileTransferList();
			if (result.Ok)
				return result.Value.Where(x => x.ServerFileTransferId == token.ServerTransferId).WrapSingle();
			return R<FileTransfer, CommandError>.Err(result.Error);
		}
コード例 #2
0
 public FileTransfer GetStats(FileTransferToken token)
 {
     lock (token)
     {
         if (token.Status != TransferStatus.Trasfering)
         {
             return(null);
         }
     }
     try { return(parent.FileTransferList().FirstOrDefault(x => x.ServerFileTransferId == token.ServerTransferId)); }
     // catch case when transfer is not found (probably already over or not yet started)
     catch (Ts3CommandException ts3ex) when(ts3ex.ErrorStatus.Id == Ts3ErrorCode.database_empty_result)
     {
         return(null);
     }
 }