Example #1
0
        public List <Faction> ParseStarMapFactionsParallel(JObject response, string systemName)
        {
            List <Faction> Factions = new List <Faction>();
            JArray         factions = (JArray)response?["factions"];

            if (factions != null)
            {
                Factions = factions
                           .AsParallel()
                           .Select(f => ParseStarMapFaction(f.ToObject <JObject>(), systemName))
                           .Where(f => f != null)
                           .ToList();
            }
            return(Factions);
        }
Example #2
0
        public List <Body> ParseStarMapBodiesParallel(JObject response)
        {
            List <Body> Bodies = new List <Body>();

            if (response != null)
            {
                string system = (string)response["name"];
                JArray bodies = (JArray)response["bodies"];

                if (bodies != null)
                {
                    Bodies = bodies
                             .AsParallel()
                             .Select(b => ParseStarMapBody(b.ToObject <JObject>(), system))
                             .Where(b => b != null)
                             .ToList();
                }
            }
            return(Bodies);
        }
Example #3
0
        public List <Station> ParseStarMapStationsParallel(JObject response)
        {
            List <Station> Stations = new List <Station>();

            if (response != null)
            {
                string system   = (string)response["name"];
                JArray stations = (JArray)response["stations"];

                if (stations != null)
                {
                    Stations = stations
                               .AsParallel()
                               .Select(s => ParseStarMapStation(s.ToObject <JObject>(), system))
                               .Where(s => s != null)
                               .ToList();
                }
                // Sort stations by distance
                Stations = Stations.OrderBy(o => o.distancefromstar).ToList();
            }
            return(Stations);
        }