public StartExecutionMessage CreateStartExecutionMessageFromCommandLine() { CommandSwitches switches = GetSwitches(); return(new StartExecutionMessage { FileName = switches.ExecutableFileName, Arguments = switches.Arguments, Timeout = switches.Timeout, WorkingDirectory = switches.WorkingDirectory }); }
public CommandSwitches GetSwitches() { var cmdLineParser = new CommandLineParser(_args); var switches = new CommandSwitches(); try { switches = cmdLineParser.BuildOptions(switches); } catch (CmdLineParserException ex) { Console.WriteLine(ex.Message); Usage(); Environment.Exit(1); } return(switches); }
static void Main(string[] args) { var cmdLineHandler = new CommandLineHandler(args); CommandSwitches switches = cmdLineHandler.GetSwitches(); StartExecutionMessage startMsg = cmdLineHandler.CreateStartExecutionMessageFromCommandLine(); EndpointAddress endpointAddress = new EndpointAddress(switches.EndpointAddress); WSDualHttpBinding serviceBinding = new WSDualHttpBinding(); if (startMsg.Timeout > 0) { serviceBinding.ReceiveTimeout = TimeSpan.FromSeconds(startMsg.Timeout); } var callbackHandler = new ConsoleCallbackHandler(); var svcProxy = new ConsoleRunnerClient(new InstanceContext(callbackHandler), serviceBinding, endpointAddress); svcProxy.Run(startMsg); while (!callbackHandler.IsComplete) { Thread.Sleep(100); } }