private static void GetDataResponseNormalAsync(TwentyThree flickr, string baseUrl, Dictionary <string, string> parameters, Action <TwentyThreeResult <string> > callback) { var method = "POST"; var data = string.Empty; foreach (var k in parameters) { data += k.Key + "=" + UtilityMethods.EscapeDataString(k.Value) + "&"; } if (method == "GET" && data.Length > 2000) { method = "POST"; } if (method == "GET") { DownloadDataAsync(method, baseUrl + "?" + data, null, null, null, callback); } else { DownloadDataAsync(method, baseUrl, data, PostContentType, null, callback); } }
private static string GetDataResponseNormal(TwentyThree flickr, string baseUrl, Dictionary <string, string> parameters) { string method = "POST"; string data = string.Empty; foreach (var k in parameters) { data += k.Key + "=" + UtilityMethods.EscapeDataString(k.Value) + "&"; } if (method == "GET" && data.Length > 2000) { method = "POST"; } if (method == "GET") { return(DownloadData(method, baseUrl + "?" + data, null, null, null)); } else { return(DownloadData(method, baseUrl, data, PostContentType, null)); } }
/// <summary> /// Calculates the Flickr method cal URL based on the passed in parameters, and also generates the signature if required. /// </summary> /// <param name="parameters">A Dictionary containing a list of parameters to add to the method call.</param> /// <param name="includeSignature">Boolean use to decide whether to generate the api call signature as well.</param> /// <returns>The <see cref="Uri"/> for the method call.</returns> public string CalculateUri(Dictionary <string, string> parameters, bool includeSignature) { if (includeSignature) { string signature = CalculateAuthSignature(parameters); parameters.Add("api_sig", signature); } var url = new StringBuilder(); url.Append("?"); foreach (KeyValuePair <string, string> pair in parameters) { var escapedValue = UtilityMethods.EscapeDataString(pair.Value ?? ""); url.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}&", pair.Key, escapedValue); } return(BaseUri.AbsoluteUri + url.ToString()); }