public static void getServs(MadForm form) { try { string MoodysWebstring = @"https://mc-monitoring.info/api/servers?page=" + 1; Uri MoodysWebAddress = new Uri(MoodysWebstring); HttpWebRequest request = WebRequest.Create(MoodysWebAddress) as HttpWebRequest; request.Method = "GET"; string results = string.Empty; HttpWebResponse response; try { using (response = request.GetResponse() as HttpWebResponse) { StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); JObject jobj = new JObject(); jobj = JObject.Parse(reader.ReadToEnd()); foreach (JObject jobj2 in jobj["servers"]["data"]) { if (!jobj2["launcher"].ToString().Equals("1") & ServerList.Count <= 21) { ServerList.Add(new server(jobj2["version"].ToString(), jobj2["addr"].ToString(), jobj2["icon_src"].ToString(), jobj2["name"].ToString())); } } } } catch (Exception e2) { } } catch (Exception e) { } }
public void getMad(MadForm madForm) { this.madForm = madForm; }