Exemple #1
0
        ConfigStatus ParseParamsCmd(LaunchParams parameters,
                                    IDictionary <string, string> queryParams)
        {
            if (!queryParams.ContainsKey(QueryParamMapping.Cmd))
            {
                return(ConfigStatus.OkStatus());
            }

            string queryParamsCmd = queryParams[QueryParamMapping.Cmd];

            if (string.IsNullOrWhiteSpace(parameters.Cmd))
            {
                parameters.Cmd = queryParamsCmd;
                return(ConfigStatus.OkStatus());
            }

            // The cmd is valid only if the binary name is the same as in
            // the project output.
            string settingsBinaryName =
                parameters.Cmd.Split(' ').First(s => !string.IsNullOrEmpty(s));
            string queryBinaryName =
                queryParamsCmd.Split(' ').FirstOrDefault(s => !string.IsNullOrEmpty(s));

            if (queryBinaryName != settingsBinaryName)
            {
                return(ConfigStatus.ErrorStatus(
                           ErrorStrings.InvalidBinaryName(settingsBinaryName, queryBinaryName)));
            }

            parameters.Cmd = queryParamsCmd;

            return(ConfigStatus.OkStatus());
        }