public XElement ExecuteRequest (NameValueCollection arguments)
 {
     var doc = new XDocument (
           new XElement ("Arguments", 
                       arguments.OfType<string> ().Select (key =>
                 new XElement ("Argument",
                           new XElement ("Key", key),
                           new XElement ("Value", arguments [key])))
             .OfType<object> ().ToArray ()));
     return doc.Root;
 }
 public XElement ExecuteRequest (NameValueCollection arguments)
 {
     var doc = new XDocument (
           new XElement ("Arguments", 
                       arguments.OfType<string> ().Select (key =>
                 new XElement ("Argument",
                           new XElement ("Key", key),
                           new XElement ("Value", arguments [key])))
             .OfType<object> ().ToArray ()));
     _captureResult (doc.Root);
     XNamespace ns = "http://sdb.amazonaws.com/doc/2009-04-15/";
     return new XElement(ns + "SelectResponse", new XElement(ns + "SelectResult", new XElement[]
         {
             new XElement(ns + "Item", new XElement[]{
                 new XElement(ns + "Name", "ItemName1"),
                 new XElement(ns + "Attribute", new XElement[] {
                     new XElement(ns + "Name", "Count"),
                     new XElement(ns + "Value", 1)
                 })
             })
         }));
 }
예제 #3
0
파일: Curl.cs 프로젝트: wolfweb/Ww
 public String PostAsForm(String url, NameValueCollection form, Boolean useSignature = false) {
     var args = form.OfType<String>().Select(k => new KeyValuePair<String, String>(k, form.Get(k)));
     return Post(url, FormSerializer.Serialize(args), FormType, useSignature);
 }
예제 #4
0
        /// <summary>
        /// Gets the beetle parameters.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public static List<KeyValuePair<string, string>> GetBeetleParameters(NameValueCollection parameters) {
            if (parameters == null) return null;

            return parameters
                .OfType<string>()
                .Where(k => !string.IsNullOrWhiteSpace(k) && k.StartsWith("!e"))
                .Select(k => {
                    var v = parameters[k];
                    var i = v.IndexOf(':');
                    var exp = v.Substring(0, i);
                    var args = v.Substring(i + 1);
                    return new KeyValuePair<string, string>(exp, args);
                })
                .ToList();
        }