Beispiel #1
0
        public static void GetFlightsEnrouteToAirport(FlightXML2SoapClient client)
        {
            Console.WriteLine("What Airport ID would you like to search? Example: KIAD, KSFO, KJFK");
            string airportID       = Console.ReadLine();
            int    resultsReturned = 10;        //Max number of results returned
            string aircraftFilter  = "airline"; //Limit results to airline traffic only
            int    offest          = 0;         //Soonest results first

            EnrouteStruct flightsEnroute = client.Enroute(airportID, resultsReturned, aircraftFilter, offest);

            foreach (EnrouteFlightStruct e in flightsEnroute.enroute)
            {
                DateTime departureTimestamp = UnixTimeStampToDateTime(Double.Parse(e.actualdeparturetime.ToString()));
                DateTime arrivalTimestamp   = UnixTimeStampToDateTime(Double.Parse(e.estimatedarrivaltime.ToString()));

                Console.WriteLine("Identifier: " + e.ident);
                Console.WriteLine("Origin: " + e.originCity + " (" + e.origin + ")");
                Console.WriteLine("Departure Time: " + departureTimestamp.ToString());
                Console.WriteLine("Destination: " + e.destinationCity + " (" + e.destination + ")");
                Console.WriteLine("Estimated Arrival Time: " + arrivalTimestamp.ToString());
                Console.WriteLine("Press Enter to Continue...");
                Console.ReadLine();
            }
            MainMenu();
        }
        static void Main(string[] args)
        {
            try
            {

                FlightXML2SoapClient client = new FlightXML2SoapClient();

                // Treat the test certificate as trusted
                client.ClientCredentials.UserName.UserName = "******";
                client.ClientCredentials.UserName.Password = "******";

                EnrouteStruct r = client.Enroute("KAUS", 10, "", 0);
                foreach (EnrouteFlightStruct e in r.enroute)
                {
                    System.Console.WriteLine(e.ident);
                }

                System.Console.WriteLine(client.Metar("KAUS"));

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {

            }

            Console.WriteLine("...");
            Console.ReadLine();
        }
Beispiel #3
0
        public static void GetMETARForSpecifiedAirport(FlightXML2SoapClient client)
        {
            Console.WriteLine("What Airport ID would you like to search? Example: KIAD, KSFO, KJFK");
            string airportID = Console.ReadLine();

            string currentMETAR = client.Metar(airportID);

            Console.Write(currentMETAR);
            Console.ReadLine();

            MainMenu();
        }
Beispiel #4
0
        public static void MainMenu()
        {
            FlightXML2SoapClient client = new FlightXML2SoapClient();

            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            Console.WriteLine("Select from one of the following options:");
            Console.WriteLine("1: Gather Flights Enroute to Specified Airport");
            Console.WriteLine("2: Get METAR (Weather Info) for Specified Airport");
            Console.WriteLine("Select 1 or 2");

            int response = new int();

            try
            {
                response = int.Parse(Console.ReadLine());
            }
            catch
            {
                response = 0;
                Console.WriteLine("Invalid Response!");
                MainMenu();
            }

            switch (response)
            {
            case 1:
                GetFlightsEnrouteToAirport(client);
                break;

            case 2:
                GetMETARForSpecifiedAirport(client);
                break;

            default:
                Console.WriteLine("Invalid Response!");
                MainMenu();
                break;
            }
        }
Beispiel #5
0
        public void init()
        {
            if (TURN_OFF_CERTIFICATE_VALIDATION)
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
            }

            endpoints.Add(new OMFEndpoint
            {
                url           = "https://example.com",
                producerToken = "YOUR_PRODUCER_TOKEN_HERE"
            });

            createTypes(endpoints);


            // set up the source
            FlightXML2SoapClient client = new FlightXML2SoapClient();

            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            AirportInfoStruct airport = client.AirportInfo(airportCode);

            sendAirport(endpoints, airportCode, airport);

            link(endpoints, new LinkRef {
                typeid = "airport", index = "_ROOT"
            }, new LinkRef {
                typeid = "airport", index = airportCode
            });

            EnrouteStruct r = client.Enroute(airportCode, 15, "", 0);

            foreach (EnrouteFlightStruct e in r.enroute)
            {
                if (isEnroute(e))
                {
                    trackedFlights.Add(e.ident, client.InFlightInfo(e.ident));

                    sendFlight(endpoints, e);

                    link(endpoints, new LinkRef {
                        index = airportCode, typeid = "airport"
                    }, new LinkRef {
                        index = e.ident, typeid = "flight"
                    });
                    link(endpoints, new LinkRef {
                        index = e.ident, typeid = "flight"
                    }, new LinkRef {
                        containerid = e.ident
                    });
                }
            }

            while (!Console.KeyAvailable)
            {
                foreach (KeyValuePair <string, InFlightAircraftStruct> entry in trackedFlights)
                {
                    InFlightData flightData = new InFlightData(entry.Value);

                    sendFlightData(endpoints, new Data <InFlightData>(entry.Key, true).Add(flightData));
                }

                Thread.Sleep(600000);
            }
        }