コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 private bool HaveConnectionsFromAPI()
 {
     return(HttpRequests.GET(API_HAVE_CONNECTIONS).IsSuccessStatusCode);
 }