예제 #1
0
        string Query(Dictionary <string, string> args)
        {
            var nonce = GetNonce().ToString();

            args.Add("nonce", nonce);
            var dataStr = BuildPostData(args);
            var data    = Encoding.ASCII.GetBytes(dataStr);

            if (Filtering.AppRequestMode == Filtering.RequestModes.WebBrowser)
            {
                var headers = string.Format("key: {0}\r\nSign: {1}\r\n", _key, ByteArrayToString(_hashMaker.ComputeHash(data)).ToLower());
                var sms     = new SMSRequestWebBrowser();
                return(sms.GetResponse("https://btc-e.com/tapi", data, headers));
            }
            else if (Filtering.AppRequestMode == Filtering.RequestModes.SmoothHttpRequest)
            {
                var collection = new WebHeaderCollection {
                    { "Key", _key }, { "Sign", ByteArrayToString(_hashMaker.ComputeHash(data)).ToLower() }
                };
                var sms = new SMSRequestSmoothHttpRequest();
                return(sms.GetResponse("https://btc-e.com/tapi", data, collection));
            }
            else //SimpleHttpRequest
            {
                var collection = new WebHeaderCollection {
                    { "Key", _key }, { "Sign", ByteArrayToString(_hashMaker.ComputeHash(data)).ToLower() }
                };
                var sms = new SMSSimpleHttpRequest();
                return(sms.GetResponse("https://btc-e.com/tapi", data, collection));
            }
        }
예제 #2
0
 public static string Query(string url)
 {
     if (Filtering.AppRequestMode == Filtering.RequestModes.WebBrowser)
     {
         var sms = new SMSRequestWebBrowser();
         return(sms.GetResponse(url));
     }
     else if (Filtering.AppRequestMode == Filtering.RequestModes.SmoothHttpRequest)
     {
         var sms = new SMSRequestSmoothHttpRequest();
         return(sms.GetResponse(url));
     }
     else //SimpleHTTPRequest
     {
         var sms = new SMSSimpleHttpRequest();
         return(sms.GetResponse(url));
     }
 }