Beispiel #1
0
        public static void LoadAll(ProgressBar stations, ProgressBar structures)
        {
            // public structures
            string         url = "https://esi.tech.ccp.is/latest/universe/structures/?datasource=tranquility";
            HttpWebRequest web = (HttpWebRequest)WebRequest.CreateHttp(url);

            web.Method        = "GET";
            web.ContentLength = 0;


            JArray jarr;
            var    response = web.GetResponse();

            using (var sr = new StreamReader(response.GetResponseStream()))
            {
                jarr = JArray.Parse(sr.ReadToEnd());
            }

            foreach (JToken tok in jarr)
            {
                JumpLoc.Get(tok.Value <long>());
            }
            JumpLocationsModel.Model.SaveChanges();

            // strucures
            long max   = 1030000000000;
            long start = 1021000000000;

            for (long id = start; id <= max; id++)
            {
                JumpLoc.Get(id);
                structures.Value = (int)(100D * (double)(id - start) / (max - start));
            }
            JumpLocationsModel.Model.SaveChanges();

            // stations
            max   = 70000000;
            start = 60000000;

            for (long id = start; id <= max; id++)
            {
                JumpLoc.Get(id);
                stations.Value = (int)(100D * (double)(id - start) / (max - start));
            }
            JumpLocationsModel.Model.SaveChanges();
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     JumpLoc.LoadAll(this.stationBar, this.structureBar);
 }