Exemplo n.º 1
0
        /// <summary>
        /// Gets the Query
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private string GetQuery(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            var param = new List <KeyValuePair <string, string> >();

            if (parameters != null)
            {
                param.AddRange(parameters);
            }

            param.Add(KV.Create("version", version));
            return(string.Join("&", param
                               .Select(kv => KV.Create(HttpUtility.UrlEncode(kv.Key), HttpUtility.UrlEncode(kv.Value)))
                               .Select(kv => string.Format("{0}={1}", kv.Key, kv.Value))
                               .ToArray()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the Query
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private string GetQuery(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            var param = new List <KeyValuePair <string, string> >();

            if (parameters != null)
            {
                param.AddRange(parameters);
            }

            param.Add(KV.Create("version", version));

            if (param.All(x => x.Key != "wt"))
            {
                // only set wt=xml if wt wasn't already set by the caller
                param.Add(KV.Create("wt", "xml"));
            }

            return(string.Join("&", param
                               .Select(kv => KV.Create(HttpUtility.UrlEncode(kv.Key), HttpUtility.UrlEncode(kv.Value)))
                               .Select(kv => string.Format("{0}={1}", kv.Key, kv.Value))
                               .ToArray()));
        }