private List <ConnectionEvent> GetConnectionsFromAPI() { string result = HttpRequests.GET(API_GET_CONNECTIONS).Content.ReadAsStringAsync().Result; List <string> IPList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >(result); foreach (string IP in IPList) { Connections.Add(new ConnectionEvent() { IPAddress = IP }); } return(Connections); }
private bool SetConnectionsToAPI(bool Clear = false) { List <string> IPs = new List <string>(); if (!Clear) { foreach (ConnectionEvent ce in Connections) { IPs.Add(ce.IPAddress); } } LogWritter.Write(string.Format("IPs for API: {0}", IPs.Count)); return(HttpRequests.POST(API_SET_CONNECTIONS, Newtonsoft.Json.JsonConvert.SerializeObject(IPs, Newtonsoft.Json.Formatting.Indented)).IsSuccessStatusCode); }
private bool HaveConnectionsFromAPI() { return(HttpRequests.GET(API_HAVE_CONNECTIONS).IsSuccessStatusCode); }