3using System.Runtime.InteropServices;
7using System.Threading.Tasks;
17 readonly
string toolName;
18 readonly
string toolPath;
29 this.toolName = toolName ??
throw new ArgumentNullException(nameof(toolName));
30 this.toolPath = toolPath ??
throw new ArgumentNullException(nameof(toolPath));
31 this.listener = listener;
33 if (Directory.Exists(toolPath) ==
false)
34 throw new DirectoryNotFoundException($
"Could not locate tool path {toolPath}.");
44 return listener.ReceiveAsync(@event, cancellationToken);
79 var buffer = Encoding.UTF8.GetBytes(line);
80 var reader =
new Utf8JsonReader(buffer);
81 if (reader.Read() ==
false)
82 throw new JsonException();
100 foreach (var name
in (Span<string>)[toolName +
".exe", toolName])
101 if (File.Exists(Path.Combine(toolPath, name)))
102 return Path.Combine(toolPath, name);