Beispiel #1
0
        public FlightPlan GetExternalFlightPlan(string id)
        {
            FlightPlan plan    = null;
            var        servers = _context.servers;
            string     content = "";

            foreach (Server server in servers)
            {
                string site = server.ServerURL.ToLower();
                site = site.Replace("http://", "").Replace("www", "");
                var    client  = new WebClient();
                string request = "http://" + site + "/api/FlightPlan/" + id;
                content = client.DownloadString(request);
                content = content.Replace("\n", "").Replace("\t", "").Replace("\r", "");
                var        json_plan_object = JObject.Parse(content);
                FlightPlan flightPlan       = new FlightPlan();
                try
                {
                    flightPlan.BuildExternal(json_plan_object, id);
                }catch (Exception e)
                {
                    if (e != null)
                    {
                        continue;
                    }
                }
                //reaches here if build is succesfull
                plan = flightPlan;
                break;
            }
            return(plan);
        }