private void M_Games_SelectedValueChanged(object sender, EventArgs e) { string item = (string)m_Games.SelectedItem; foreach(string i in serverslist) { ServerItem v = JsonConvert.DeserializeObject<ServerItem>(i); if(item == v.name + " " + v.status) { m_ipAddr.Text = v.ip; } } }
public Hub() { netListener = new EventBasedNetListener(); client = new NetManager(netListener); InitializeComponent(); serverslist = new List<string>(); using(WebClient c = new WebClient()) { string servers = c.DownloadString("http://atari0.cf/engine/servers.php"); foreach (string i in servers.Split('|')) { ServerItem v = JsonConvert.DeserializeObject<ServerItem>(i); try { m_Games.Items.Add(v.name + " " + v.status); serverslist.Add(i); } catch (Exception) { } } } }