private IBrokerClient CreateBrokerClient(string name, string path, CancellationToken cancellationToken) {
path = path ?? new RInstallation().GetCompatibleEngines().FirstOrDefault()?.InstallPath;
Uri uri;
if (!Uri.TryCreate(path, UriKind.Absolute, out uri)) {
return null;
}
if (uri.IsFile) {
return new LocalBrokerClient(name, uri.LocalPath, _services, _console);
}
return new RemoteBrokerClient(name, uri, _services, _console, cancellationToken);
}