本文整理汇总了C#中System.CommandLine.GetRunSetName方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLine.GetRunSetName方法的具体用法?C# CommandLine.GetRunSetName怎么用?C# CommandLine.GetRunSetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CommandLine
的用法示例。
在下文中一共展示了CommandLine.GetRunSetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRunSets
/// <summary>
/// This is run when there are a group of runsets in the app.config
/// Run Sets allow for different options to be run on different occasions
/// The runset is specified on the command line
/// </summary>
/// <param name="server">
/// The WSUS Server
/// </param>
/// <param name="runSets">
/// Group of runsets
/// </param>
/// <param name="commandLine">
/// Information on what was specified on the command line
/// </param>
/// <param name="isTest">
/// Whether we are in test mode
/// </param>
private static void DoRunSets(
// Model.ApplicationSettings settings,
IUpdateServer server,
RunSetCollection runSets,
CommandLine commandLine,
bool isTest)
{
// we need to work out which runset is being done
// we'll limit the command line to one runset
string requestedRunSet = commandLine.GetRunSetName();
RunSet requiredRunSet =
runSets.Cast<RunSet>()
.FirstOrDefault(runSet => requestedRunSet.Equals(runSet.Name, StringComparison.OrdinalIgnoreCase));
if (requiredRunSet == null)
{
throw new ArgumentException(
"The RunSet '" + requestedRunSet
+ "' as requested on the command line is not defined in the app.config.");
}
DoRunSet(server, requiredRunSet, isTest);
}