void ReadServersList() { serversList = serverComm.ReadJSON(); servers = serversList.Servers; cBserverList.Items.Clear(); foreach (var i in servers) { cBserverList.Items.Add(Convert.ToString(i.Name)); } }
void WriteServersList(ServersList serversList) { try { var jsonToWrite = JsonConvert.SerializeObject(serversList, Formatting.Indented); using (var writer = new StreamWriter(_path)) { writer.Write(jsonToWrite); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ServersList GetServersList() { var serversList = new ServersList { Servers = new List <Server> { new Server { Id = 0, Name = "Wiki Media", Type = -1, Link = "https://maps.wikimedia.org/osm-intl/{0}/{1}/{2}.png", ServerLoad = 0, AppID = "", AppCode = "", HitsStartDate = DateTime.Now, Hits = 0, DateToResetHits = DateTime.Now.AddMonths(1) }, new Server { Id = 1, Name = "Here Satellite", Type = 25000, Link = "https://{5}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/satellite.day/{0}/{1}/{2}/256/png8?app_id={3}&app_code={4}", ServerLoad = 4, AppID = "F9VSVW1GjhHP7TUVMcqf", AppCode = "CI1lzWESsMs7w6RYwKEPFQ", HitsStartDate = DateTime.Now, Hits = 1, DateToResetHits = DateTime.Now.AddMonths(1) }, } }; return(serversList); }