コード例 #1
0
        private static bool ParseOpsMgrConfigArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            if (ConsumeArgument(commandlineArgument, arguments[index], "opsmgr"))
            {
                commandlineArgument.Parameter = true;
                index++;
                return(true);
            }

            return(false);
        }
コード例 #2
0
        private static bool ParseAcceptLicenseArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            if (ConsumeArgument(commandlineArgument, arguments[index], "IACCEPTSCEULA"))
            {
                commandlineArgument.Parameter = true;
                index++;
                return(true);
            }

            return(false);
        }
コード例 #3
0
        private static bool ParseOemSetupArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            if (ConsumeArgument(commandlineArgument, arguments[index], "prep"))
            {
                commandlineArgument.Parameter = true;
                index++;
                return(true);
            }

            return(false);
        }
コード例 #4
0
        private static bool ParseCertificateThumbprintArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            if (ConsumeArgument(commandlineArgument, arguments[index], "CmpCertificateThumbprint"))
            {
                if (FetchValue(commandlineArgument, arguments, index))
                {
                    index++;
                    commandlineArgument.Parameter = (String)commandlineArgument.Parameter;

                    arguments[index] = (String)commandlineArgument.Parameter;
                    index++;
                    return(true);
                }
            }
            return(false);
        }
コード例 #5
0
        private static bool ParseActionArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            String[]       parameters = { "i", "x", "runui" };
            SetupActions[] actions    = { SetupActions.UnattendedInstall, SetupActions.UnattendedUninstall, SetupActions.UserInterface };

            for (int iterator = 0; iterator < parameters.Length; iterator++)
            {
                if (ConsumeArgument(commandlineArgument, arguments[index], parameters[iterator]))
                {
                    commandlineArgument.Parameter = actions[iterator];
                    index++;
                    return(true);
                }
            }

            return(false);
        }
コード例 #6
0
        private static bool ParseSetupLocationArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            if (ConsumeArgument(commandlineArgument, arguments[index], "SetupLocation"))
            {
                if (FetchValue(commandlineArgument, arguments, index))
                {
                    index++;
                    commandlineArgument.Parameter = ValidateDirectoryPath((String)commandlineArgument.Parameter);

                    arguments[index] = (String)commandlineArgument.Parameter;

                    SetupLogger.LogInfo("file path {0}", commandlineArgument.Parameter);
                    index++;
                    return(true);
                }
            }
            return(false);
        }
コード例 #7
0
        private static bool FetchValue(CommandlineArgument commandlineArgument, String[] arguments, int index)
        {
            if (index + 1 < arguments.Length)
            {
                if (IsArgument(arguments[index + 1]))
                {
                    throw new Exception(String.Format("The parameter {0} does not have a value associated with it", arguments[index]));
                }

                index++;
                commandlineArgument.Parameter = arguments[index];

                return(true);
            }
            else
            {
                throw new Exception(String.Format("The parameter {0} does not have a value associated with it", arguments[index]));
            }
        }
コード例 #8
0
        private static bool ParseOptionsArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            const string optionsParameter = @"options";

            if (ConsumeArgument(commandlineArgument, arguments[index], optionsParameter))
            {
                if (FetchValue(commandlineArgument, arguments, index))
                {
                    index++;
                    commandlineArgument.Parameter = ValidateFilePath((String)commandlineArgument.Parameter);

                    arguments[index] = (String)commandlineArgument.Parameter;

                    SetupLogger.LogInfo("MST file path {0}", commandlineArgument.Parameter);
                    index++;
                    return(true);
                }
            }

            return(false);
        }
コード例 #9
0
        private static bool ConsumeArgument(CommandlineArgument commandlineArgument, String argument, String parameter, bool throwOnDuplicate = true)
        {
            foreach (String marker in CommandlineParameterMarkers)
            {
                int comparison = String.Compare(argument, marker + parameter, true);
                if (comparison == 0)
                {
                    if (commandlineArgument.Valid == true)
                    {
                        SetupLogger.LogError("Argument {0} already set", argument);
                        if (throwOnDuplicate)
                        {
                            throw new Exception(String.Format("The parameter {0} is already specified.", argument));
                        }
                    }

                    return(true);
                }
            }

            return(false);
        }
コード例 #10
0
        private static bool ParseFeatureArgument(CommandlineArgument commandlineArgument, String[] arguments, ref int index)
        {
            String[]        parameters = { "tenant", "admin", "server" };
            SetupFeatures[] features   = { SetupFeatures.TenantExtension, SetupFeatures.AdminExtension, SetupFeatures.Server };

            for (int iterator = 0; iterator < parameters.Length; iterator++)
            {
                if (ConsumeArgument(commandlineArgument, arguments[index], parameters[iterator], throwOnDuplicate:false))
                {
                    if ((commandlineArgument.Parameter != null) && (commandlineArgument.Parameter is SetupFeatures))
                    {
                        commandlineArgument.Parameter = features[iterator] | (SetupFeatures)commandlineArgument.Parameter;
                    }
                    else
                    {
                        commandlineArgument.Parameter = features[iterator];
                    }
                    index++;
                    return(true);
                }
            }

            return(false);
        }