public async Task SendEofMessage(Recipient recipient, EofMessage message) { var client = new Transmitter.TransmitterClient(_channelStore.Get(recipient.Address)); var result = await client.SendEofMessageAsync(new EofMessageTransmissionRequest { FileId = message.FileId.ToString(), AmountOfChunks = message.AmountOfChunks }); if (!result.IsSuccessful) { throw new InvalidOperationException($"'{nameof(SendEofMessage)}' received a negative 'IsSuccessful' from '{recipient.Name}'"); } }
public async Task SendFileChunk(Recipient recipient, FileChunk fileChunk) { var client = new Transmitter.TransmitterClient(_channelStore.Get(recipient.Address)); var result = await client.SendFileChunkAsync(new FileChunkTransmissionRequest { FileId = fileChunk.FileId.ToString(), SequenceNo = fileChunk.SequenceNo, Host = Environment.MachineName, Value = ByteString.CopyFrom(fileChunk.GetValue()) }); if (!result.IsSuccessful) { throw new InvalidOperationException($"'{nameof(SendFileChunk)}' received a negative 'IsSuccessful' from '{recipient.Name}'"); } }
public async Task SendFile(Recipient recipient, Folder folder, File file) { var client = new Transmitter.TransmitterClient(_channelStore.Get(recipient.Address)); var result = await client.SendFileAsync(new FileTransmissionRequest { Id = file.Id.ToString(), Name = file.Name, LastModifiedDate = Timestamp.FromDateTime(file.LastModifiedDate), Path = file.Path, Size = file.Size, Version = file.Version, FolderName = folder.Name, Host = Environment.MachineName, }); if (!result.IsSuccessful) { throw new InvalidOperationException($"'{nameof(SendFile)}' received a negative 'IsSuccessful' from '{recipient.Name}'"); } }