namespace ZB.MOM.WW.MxGateway.Server.Workers; /// /// Represents a worker process command line. /// public sealed class WorkerProcessCommandLine { /// /// Initializes a command line with executable path and arguments. /// /// Path to the worker executable. /// Command-line arguments. public WorkerProcessCommandLine( string executablePath, IReadOnlyList arguments) { ExecutablePath = executablePath; Arguments = arguments; } /// /// Gets the path to the worker executable. /// public string ExecutablePath { get; } /// /// Gets the command-line arguments. /// public IReadOnlyList 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; } }