本文整理汇总了C#中System.CommandLine.HasOption方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLine.HasOption方法的具体用法?C# CommandLine.HasOption怎么用?C# CommandLine.HasOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CommandLine
的用法示例。
在下文中一共展示了CommandLine.HasOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckOptions
public override void CheckOptions(CommandLine cmd)
{
// Confidence estimator
double confidence = Allcea.DEFAULT_CONFIDENCE;
double sizeRel = Allcea.DEFAULT_RELATIVE_SIZE;
double sizeAbs = Allcea.DEFAULT_ABSOLUTE_SIZE;
if (cmd.HasOption('c')) {
confidence = AbstractCommand.CheckConfidence(cmd.GetOptionValue('c'));
}
if (cmd.HasOption('s')) {
string[] sizeStrings = cmd.GetOptionValues('s');
if (sizeStrings.Length != 2) {
throw new ArgumentException("Must provide two target effect sizes: relative and absolute.");
}
sizeRel = AbstractCommand.CheckRelativeSize(sizeStrings[0]);
sizeAbs = AbstractCommand.CheckAbsoluteSize(sizeStrings[1]);
}
this._confEstimator = new NormalConfidenceEstimator(confidence, sizeRel, sizeAbs);
// Double format
if (cmd.HasOption('d')) {
this._decimalDigits = AbstractCommand.CheckDigits(cmd.GetOptionValue('d'));
}
// Files
this._inputPath = AbstractCommand.CheckInputFile(cmd.GetOptionValue('i'));
if (cmd.HasOption('j')) {
this._judgedPath = AbstractCommand.CheckJudgedFile(cmd.GetOptionValue('j'));
}
this._estimatedPath = AbstractCommand.CheckEstimatedFile(cmd.GetOptionValue('e'));
}
示例2: CheckOptions
public override void CheckOptions(CommandLine cmd)
{
// Double format
if (cmd.HasOption('d')) {
this._decimalDigits = AbstractCommand.CheckDigits(cmd.GetOptionValue('d'));
}
// Files
this._inputPath = AbstractCommand.CheckInputFile(cmd.GetOptionValue('i'));
if (cmd.HasOption('j')) {
this._judgedPath = AbstractCommand.CheckJudgedFile(cmd.GetOptionValue('j'));
}
// Estimator
Dictionary<string, string> parameters = Allcea.ParseNameValueParameters(cmd.GetOptionValues('p'));
this._estimator = new EstimatorWrapper(cmd.GetOptionValue('e'), parameters);
}
示例3: CheckOptions
public override void CheckOptions(CommandLine cmd)
{
// Target and confidence estimator
if (cmd.HasOption('c')) {
this._confidence = AbstractCommand.CheckConfidence(cmd.GetOptionValue('c'));
}
this._target = AbstractCommand.CheckTarget(cmd.GetOptionValue('t'));
double sizeRel = Allcea.DEFAULT_RELATIVE_SIZE;
double sizeAbs = Allcea.DEFAULT_ABSOLUTE_SIZE;
if (cmd.HasOption('s')) {
switch (this._target) {
case EvaluationTargets.Relative: sizeRel = AbstractCommand.CheckRelativeSize(cmd.GetOptionValue('s')); break;
case EvaluationTargets.Absolute: sizeAbs = AbstractCommand.CheckAbsoluteSize(cmd.GetOptionValue('s')); break;
}
}
this._confEstimator = new NormalConfidenceEstimator(this._confidence, sizeRel, sizeAbs);
// Double format
if (cmd.HasOption('d')) {
this._decimalDigits = AbstractCommand.CheckDigits(cmd.GetOptionValue('d'));
}
// Batches
this._batchNum = AbstractCommand.CheckBatchNumber(cmd.GetOptionValue('b'));
this._batchSize = AbstractCommand.CheckBatchSize(cmd.GetOptionValue('n'));
// Files
this._inputPath = AbstractCommand.CheckInputFile(cmd.GetOptionValue('i'));
this._judgedPath = AbstractCommand.CheckJudgedFile(cmd.GetOptionValue('j'));
// Estimator
Dictionary<string, string> parameters = Allcea.ParseNameValueParameters(cmd.GetOptionValues('p'));
this._estimator = new EstimatorWrapper(cmd.GetOptionValue('e'), parameters);
}