GetCommandPropertyValue() private static method

private static GetCommandPropertyValue ( string propertyName, Command commandToExecute ) : string
propertyName string
commandToExecute Command
return string
Example #1
0
        public HttpWebRequest CreateWebRequest(Uri baseUri, Command commandToExecute)
        {
            string[] array = this.resourcePath.Split(new string[]
            {
                "/"
            }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < array.Length; i++)
            {
                string text = array[i];
                if (text.StartsWith("{", StringComparison.OrdinalIgnoreCase) && text.EndsWith("}", StringComparison.OrdinalIgnoreCase))
                {
                    array[i] = CommandInfo.GetCommandPropertyValue(text, commandToExecute);
                }
            }
            string text2       = string.Join("/", array);
            Uri    relativeUri = new Uri(text2, UriKind.Relative);
            Uri    requestUri;
            bool   flag = Uri.TryCreate(baseUri, relativeUri, out requestUri);

            if (flag)
            {
                HttpWebRequest httpWebRequest = WebRequest.Create(requestUri) as HttpWebRequest;
                httpWebRequest.Method = this.method;
                return(httpWebRequest);
            }
            throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unable to create URI from base {0} and relative path {1}", new object[]
            {
                (baseUri == null) ? string.Empty : baseUri.ToString(),
                text2
            }));
        }