public static string SendRequest(Dictionary <string, string> data, string action) { try { var content = new FormUrlEncodedContent(data); var response = Client.PostAsync("https://portal.pixelfederation.com/sy/?a=" + action, content); // <xml><time>1548446333</time></xml> try { var doc = new XmlDocument(); try { string resp = response.Result.Content.ReadAsStringAsync().Result; if (resp.IsValidXml()) { doc.LoadXml(resp); } else { resp = Parser.ConvertJSONToXmlString(resp); doc.LoadXml(resp); } } catch (Exception e) { Logger.Logger.Fatal(string.Format(Localization.NETWORKING_NO_RESPONSE, response, e)); } if (doc.DocumentElement != null) { var s = Convert.ToInt64(doc.DocumentElement.SelectSingleNode("time")?.InnerText); TimeUtils.CheckForTimeMismatch(s); } } catch (Exception e) { Logger.Logger.Warning(e.ToString()); } return(response.Result.Content.ReadAsStringAsync().Result); } catch (Exception ex) { Events.Events.SyncFailedEvent.SyncFailed.Invoke(0); Logger.Logger.Fatal(ex.ToString()); } return(string.Empty); }