Example #1
0
 private void Execute(ISender client, FileTransferCancel message)
 {
     if (_activeTransfers.ContainsKey(message.Id))
     {
         RemoveFileTransfer(message.Id);
         client.Send(new FileTransferCancel
         {
             Id     = message.Id,
             Reason = "Canceled"
         });
     }
 }
Example #2
0
 public static void HandleDoDownloadFileCancel(FileTransferCancel command, Networking.Client client)
 {
     if (!CanceledFileTransfers.ContainsKey(command.Id))
     {
         CanceledFileTransfers.Add(command.Id, "canceled");
         client.Send(new FileTransferCancel
         {
             Id     = command.Id,
             Reason = "Canceled"
         });
     }
 }
Example #3
0
        private void Execute(ISender client, FileTransferCancel message)
        {
            FileTransfer transfer;

            lock (_syncLock)
            {
                transfer = _activeFileTransfers.FirstOrDefault(t => t.Id == message.Id);
            }

            if (transfer != null)
            {
                transfer.Status = message.Reason;
                OnFileTransferUpdated(transfer);
                RemoveFileTransfer(transfer.Id);
                // don't keep un-finished files
                if (transfer.Type == TransferType.Download)
                {
                    File.Delete(transfer.LocalPath);
                }
            }
        }