31 lines
719 B
C#
31 lines
719 B
C#
namespace MxGateway.Server.Workers;
|
|
|
|
public sealed class WorkerProcessCommandLine
|
|
{
|
|
public WorkerProcessCommandLine(
|
|
string executablePath,
|
|
IReadOnlyList<string> arguments)
|
|
{
|
|
ExecutablePath = executablePath;
|
|
Arguments = arguments;
|
|
}
|
|
|
|
public string ExecutablePath { get; }
|
|
|
|
public IReadOnlyList<string> Arguments { get; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Join(
|
|
" ",
|
|
new[] { Quote(ExecutablePath) }.Concat(Arguments.Select(Quote)));
|
|
}
|
|
|
|
private static string Quote(string value)
|
|
{
|
|
return value.Contains(' ', StringComparison.Ordinal)
|
|
? $"\"{value}\""
|
|
: value;
|
|
}
|
|
}
|