Esempio n. 1
0
        private static OptionSet ParseOptions(string[] args, out bool shouldShowHelp)
        {
            var showHelp = false;
            var options  = new OptionSet {
                { "j|jobName=", "The service name of the job [REQUIRED].", j => _perfJob = j },
                { "s|serverName=", "The service name of the server [REQUIRED].", s => _perfServer = s },
                { "rp|receivePort=", "The service receive from port.", rp => _receivePort = int.Parse(rp) },
                { "sp|sendPort=", "The service send to port.", sp => _sendPort = int.Parse(sp) },
                { "icp|ICPort=", "The IC port, if the IC should be run in proc. Note that if this is specified, the command line ports override stored registration settings", icp => _icPort = int.Parse(icp) },
                { "mms|maxMessageSize=", "The maximum message size.", mms => _maxMessageSize = int.Parse(mms) },
                { "n|numOfRounds=", "The number of rounds.", n => _numRounds = int.Parse(n) },
                { "nds|noDescendingSize", "Disable message descending size.", nds => _descendingSize = false },
                { "c|autoContinue", "Is continued automatically at start", c => _autoContinue = true },
                { "d|ICDeploymentMode=", "IC deployment mode specification (SecondProc(Default)/InProcDeploy/InProcManual/InProcTimeTravel)", d => _ICDeploymentMode = (ICDeploymentMode)Enum.Parse(typeof(ICDeploymentMode), d, true) },
                { "l|log=", "If TTD, the service log path.", l => _serviceLogPath = l },
                { "ch|checkpoint=", "If TTD, the checkpoint # to load.", c => _checkpointToLoad = long.Parse(c) },
                { "h|help", "show this message and exit", h => showHelp = h != null },
            };

            try
            {
                options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine("Invalid arguments: " + e.Message);
                ShowHelp(options);
                Environment.Exit(1);
            }

            shouldShowHelp = showHelp;

            return(options);
        }
Esempio n. 2
0
        private static OptionSet ParseOptions(string[] args, out bool shouldShowHelp)
        {
            var showHelp = false;
            var options  = new OptionSet {
                { "j|jobName=", "The service name of the job [REQUIRED].", j => _perfJob = j },
                { "s|serverName=", "The service name of the server [REQUIRED].", s => _perfServer = s },
                { "rp|receivePort=", "The service receive from port [REQUIRED].", rp => _receivePort = int.Parse(rp) },
                { "sp|sendPort=", "The service send to port. [REQUIRED]", sp => _sendPort = int.Parse(sp) },
                { "nbd|notBidirectional", "Disable bidirectional communication.", nbd => _isBidirectional = false },
                { "icp|ICPort=", "The IC port, if the IC should be run in proc. Note that if this is specified, the command line ports override stored registration settings", icp => _icPort = int.Parse(icp) },
                { "n|numOfJobs=", "The number of jobs.", n => _numJobs = int.Parse(n) },
                { "u|upgrading", "Is upgrading.", u => _isUpgrading = true },
                { "m|memoryUsed=", "Memory used.", m => _memoryUsed = long.Parse(m) },
                { "c|autoContinue", "Is continued automatically at start", c => _autoContinue = true },
                { "d|ICDeploymentMode=", "IC deployment mode specification (SecondProc(Default)/InProcDeploy/InProcManual/InProcTimeTravel)", d => _ICDeploymentMode = (ICDeploymentMode)Enum.Parse(typeof(ICDeploymentMode), d, true) },
                { "l|log=", "If TTD, the service log path.", l => _serviceLogPath = l },
                { "ch|checkpoint=", "If TTD, the checkpoint # to load.", c => _checkpointToLoad = long.Parse(c) },
                { "cv|currentVersion=", "The version # used to time travel debug (ignored otherwise).", cv => _currentVersion = int.Parse(cv) },
                { "h|help", "show this message and exit", h => showHelp = h != null },
            };

            try
            {
                options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine("Invalid arguments: " + e.Message);
                ShowHelp(options);
                Environment.Exit(1);
            }

            shouldShowHelp = showHelp;

            return(options);
        }