private async Task SendProjectAsync(EnvDTE.Project project, string remotePath, string filterString, CancellationToken cancellationToken) {
ProgressOutputWriter.WriteLine(Resources.Info_PreparingProjectForTransfer);
var projectDir = Path.GetDirectoryName(project.FullName);
var projectName = Path.GetFileNameWithoutExtension(project.FullName);
string[] filterSplitter = { ";" };
Matcher matcher = new Matcher(StringComparison.InvariantCultureIgnoreCase);
matcher.AddIncludePatterns(filterString.Split(filterSplitter, StringSplitOptions.RemoveEmptyEntries));
ProgressOutputWriter.WriteLine(Resources.Info_RemoteDestination.FormatInvariant(remotePath));
ProgressOutputWriter.WriteLine(Resources.Info_FileTransferFilter.FormatInvariant(filterString));
ProgressOutputWriter.WriteLine(Resources.Info_CompressingFiles);
var compressedFilePath = FileSystem.CompressDirectory(projectDir, matcher, new Progress<string>((p) => {
ProgressOutputWriter.WriteLine(Resources.Info_LocalFilePath.FormatInvariant(p));
string dest = p.MakeRelativePath(projectDir).ProjectRelativePathToRemoteProjectPath(remotePath, projectName);
ProgressOutputWriter.WriteLine(Resources.Info_RemoteFilePath.FormatInvariant(dest));
}), CancellationToken.None);
using (var fts = new DataTransferSession(Session, FileSystem)) {
ProgressOutputWriter.WriteLine(Resources.Info_TransferringFiles);
var remoteFile = await fts.SendFileAsync(compressedFilePath, true, null, cancellationToken);
await Session.EvaluateAsync<string>($"rtvs:::save_to_project_folder({remoteFile.Id}, {projectName.ToRStringLiteral()}, '{remotePath.ToRPath()}')", REvaluationKind.Normal, cancellationToken);
}
ProgressOutputWriter.WriteLine(Resources.Info_TransferringFilesDone);
}