private void OnElapsedTime(object sender, ElapsedEventArgs e) { try { timerForWriteFileContent.Stop(); FileHelper.AppendAllBytes(this, fileUploadRequests, clientPublicEncryptionkeys); timerForWriteFileContent.Start(); } catch { } }
private void FileUploadRequestHandler(FileUploadRequest request) { var response = new FileUploadResponse(request); if (request.CurrentPosition == 0) { var args = new FileUploadRequestEventArguments(() => { //Confirm File Upload response.DestinationFilePath = request.DestinationFilePath; SendMessage(response); }, () => { //Refuse File Upload response.HasError = true; response.Exception = new Exception("The file upload request was refused by the user!"); SendMessage(response); }); args.Request = request; OnFileUploadRequest(args); } else { FileHelper.AppendAllBytes(request.DestinationFilePath, request.BytesToWrite); SendMessage(response); OnUploadFileProgress(new FileUploadProgressEventArguments { CurrentPosition = request.CurrentPosition, FileName = request.FileName, TotalBytes = request.TotalBytes, DestinationPath = request.DestinationFilePath }); } }