public static void Create(string host, Dictionary <string, string> requestParams, string method, DownloadListener listener) { SimpleConnector connector = new SimpleConnector(); connector.SetServerName(host); connector.SetParams(requestParams); connector.OnRequestComplete += listener; if (method == SimpleConnector.METHOD_GET) { connector.SendGet(); } else { connector.SendPost(); } }
public void GetAccessToken(string verifier) { string timestamp = DateHelpers.DateTimeToUnitTimeStamp(DateTime.UtcNow).ToString(); SimpleConnector connector = new SimpleConnector(); connector.SetServerName(Constants.Urls.TOKEN_ACCESS); connector.AddParam("oauth_token", this.OAuthToken); connector.AddParam("oauth_consumer_key", Settings.Key); connector.AddParam("oauth_nonce", Settings.Nounce); connector.AddParam("oauth_timestamp", timestamp); connector.AddParam("oauth_verifier", verifier); connector.AddParam("oauth_signature_method", Settings.SignatireMethod); connector.AddParam("oauth_signature", this.generateSignature(this.CurrentSignatureType, "POST", Constants.Urls.TOKEN_ACCESS, connector.GetParams(), Settings.SecretKey + "&" + this.OAuthTokenSecret)); connector.OnRequestComplete += parseAccessToken; connector.OnRequestComplete += this.onRequestComplete; connector.SendPost(); }
public void GetRequestToken() { string timestamp = DateHelpers.DateTimeToUnitTimeStamp(DateTime.UtcNow).ToString(); SimpleConnector connector = new SimpleConnector(); connector.SetServerName(Constants.Urls.TOKEN_REQUEST); connector.AddParam("oauth_consumer_key", Settings.Key); connector.AddParam("oauth_nonce", Settings.Nounce); connector.AddParam("oauth_timestamp", timestamp); connector.AddParam("oauth_signature_method", Settings.SignatireMethod); connector.AddParam("oauth_signature", this.generateSignature(this.CurrentSignatureType, "POST", Constants.Urls.TOKEN_REQUEST, connector.GetParams(), Settings.SecretKey + "&")); connector.OnRequestComplete += this.parseResponse; connector.OnRequestComplete += this.onRequestComplete; connector.SendPost(); }