コード例 #1
0
ファイル: Job.cs プロジェクト: dpvreony/wsussmartapprove
        /// <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);
        }