public void RegisterUser(double latitude, double longitude, string userId, string salt) { string regUrl = REGISTER_USER_URL; regUrl = regUrl.Replace("{latitude}", latitude.ToString(CultureInfo.InvariantCulture)); regUrl = regUrl.Replace("{longitude}", longitude.ToString(CultureInfo.InvariantCulture)); regUrl = regUrl.Replace("{user-id}", userId); regUrl = regUrl.Replace("{version}", VERSION); //regUrl = regUrl + "&bc=0"; string encodeRegUrl = regUrl; encodeRegUrl += salt; string regHash = Helpers.Encode(encodeRegUrl, m_deviceKey); regUrl = regUrl + "&salt={salt}".Replace("{salt}", salt); regUrl = regUrl + "&hash={hash}".Replace("{hash}", regHash); regUrl = BASE_URL + regUrl; HttpWebRequest regRequest = WebRequest.Create(regUrl) as HttpWebRequest; regRequest.Method = "GET"; regRequest.UserAgent = USER_AGENT; HttpWebResponse regResponse = (HttpWebResponse)regRequest.GetResponse(); var content = Helpers.ReadWebResponse(regResponse); }
public string Yaks(double latitude, double longitude, string userId, double userLatitude, double userLongitude, string salt) { string url = YAKS_URL; url = url.Replace("{latitude}", latitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{longitude}", longitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{user-id}", userId); url = url.Replace("{user-latitude}", userLatitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{user-longitude}", userLongitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{version}", VERSION); string encodeUrl = url; encodeUrl += salt; string hash = Helpers.Encode(encodeUrl, m_deviceKey); url = url + "&salt={salt}".Replace("{salt}", salt); url = url + "&hash={hash}".Replace("{hash}", hash); url = BASE_URL + url; HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "GET"; request.UserAgent = USER_AGENT; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); return(Helpers.ReadWebResponse(response)); }
public Task RegisterUserAsync(double latitude, double longitude, string userId, string salt) { string regUrl = REGISTER_USER_URL; regUrl = regUrl.Replace("{latitude}", latitude.ToString(CultureInfo.InvariantCulture)); regUrl = regUrl.Replace("{longitude}", longitude.ToString(CultureInfo.InvariantCulture)); regUrl = regUrl.Replace("{user-id}", userId); regUrl = regUrl.Replace("{version}", VERSION); //regUrl = regUrl + "&bc=0"; string encodeRegUrl = regUrl; encodeRegUrl += salt; string regHash = Helpers.Encode(encodeRegUrl, m_deviceKey); regUrl = regUrl + "&salt={salt}".Replace("{salt}", salt); regUrl = regUrl + "&hash={hash}".Replace("{hash}", regHash); regUrl = BASE_URL + regUrl; HttpWebRequest request = WebRequest.Create(regUrl) as HttpWebRequest; request.Method = "GET"; request.UserAgent = USER_AGENT; if (string.IsNullOrEmpty(m_proxy_address) == false) { request.Proxy = new WebProxy(m_proxy_address); } //var response = await request.GetResponseAsync(); //var content = await Helpers.ReadWebResponseAsync(response); return(request.GetResponseAsync()); }
public async Task <string> YaksAsync(double latitude, double longitude, string userId, double userLatitude, double userLongitude, string salt) { string url = YAKS_URL; //string url = GET_MESSAGES_URL; url = url.Replace("{latitude}", latitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{longitude}", longitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{user-id}", userId); url = url.Replace("{user-latitude}", userLatitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{user-longitude}", userLongitude.ToString(CultureInfo.InvariantCulture)); //url = url.Replace("{user-latitude}", latitude.ToString(CultureInfo.InvariantCulture)); //url = url.Replace("{user-longitude}", longitude.ToString(CultureInfo.InvariantCulture)); url = url.Replace("{version}", VERSION); url = url + "&bc=0"; string encodeUrl = url; encodeUrl += salt; string hash = Helpers.Encode(encodeUrl, m_deviceKey); url = url + "&salt={salt}".Replace("{salt}", salt); url = url + "&hash={hash}".Replace("{hash}", hash); url = BASE_URL + url; HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "GET"; request.UserAgent = USER_AGENT; // ** Set a proxy if configured if (string.IsNullOrEmpty(m_proxy_address) == false) { request.Proxy = new WebProxy(m_proxy_address); } var response = await request.GetResponseAsync(); var content = await Helpers.ReadWebResponseAsync(response); return(content); }