private void FileUploadHandler(IRequest request) { var uploadRequest = (FileUploadRequest)request; SendReponse(new FileUploadResponse()); lock (_files) { if (!_files.ContainsKey(uploadRequest.ReceiverNumber)) { _files.Add(uploadRequest.ReceiverNumber, new List <GuidedFile>()); } var file = new GuidedFile(new File(uploadRequest.OriginalName, uploadRequest.FileBytes, _clientNumber), Guid.NewGuid()); _files[uploadRequest.ReceiverNumber].Add(file); } }
private void FileDownloadHandler(IRequest request) { var fileDownloadRequest = (FileDownloadRequest)request; GuidedFile fileToDownload = null; foreach (var file in _filesToDownload) { if (file.Guid.Equals(fileDownloadRequest.FileGuid)) { fileToDownload = file; } break; } _filesToDownload.Remove(fileToDownload); var response = new FileDownloadResponse(fileToDownload.File); SendReponse(response); }