Пример #1
0
        internal static FlightDataEntitiesRT.Flight FromDataInput(AircraftDataInput.Flight flight)
        {
            var rt = new FlightDataEntitiesRT.Flight()
            {
                Aircraft = new FlightDataEntitiesRT.AircraftInstance()
                {
                    AircraftModel = new FlightDataEntitiesRT.AircraftModel()
                    {
                        ModelName = flight.Aircraft.AircraftModel.ModelName,
                        Caption = flight.Aircraft.AircraftModel.Caption
                    },
                    AircraftNumber = flight.Aircraft.AircraftNumber,
                    LastUsed = flight.Aircraft.LastUsed
                },
                FlightID = flight.FlightID,
                FlightName = flight.FlightName,
                StartSecond = flight.StartSecond,
                EndSecond = flight.EndSecond
            };

            return rt;
        }
Пример #2
0
        public static bool BuildTempFlightByRule(StorageFile file, FlightDataEntitiesRT.AircraftModel aircraftModel, FlightDataEntitiesRT.FlightParameters flightParameter, ref FlightDataEntitiesRT.IFlightRawDataExtractor extractor, ref FlightDataEntitiesRT.Flight currentFlight)
        {
            bool correct = true;

            if (aircraftModel != null && !string.IsNullOrEmpty(aircraftModel.ModelName))
            {
                //if (aircraftModel.ModelName == "F4D")
                //{
                var result = FlightDataReading.AircraftModel1.FlightRawDataExtractorFactory
                    .CreateFlightRawDataExtractor(file, flightParameter);
                extractor = result;
                //}
            }

            var aircraft = new FlightDataEntitiesRT.AircraftInstance()
            {
                AircraftModel = aircraftModel,
                LastUsed = DateTime.Now
            };
            try
            {
                var aircraftNumber = (extractor as FlightDataReading.AircraftModel1.FlightDataReadingHandler).ParseAircraftNumber(file.Name);
                aircraft.AircraftNumber = aircraftNumber;
            }
            catch
            {
                correct = false;
            }

            currentFlight = new FlightDataEntitiesRT.Flight()
            {
                Aircraft = aircraft,
                StartSecond = 0,
                FlightName = file.Name,
                FlightID = RemoveFlightPHYFileIllegalChars(file.DisplayName)
            };

            try
            {
                currentFlight.FlightDate = (extractor as FlightDataReading.AircraftModel1.FlightDataReadingHandler).ParseDate(file.Name);
            }
            catch
            {
                correct = false;
            }
            return correct;
        }
 /// <summary>
 /// 临时的方法,多个机型后要考虑使用别的方式创建,例如反射
 /// </summary>
 /// <param name="file"></param>
 /// <param name="aircraftModel"></param>
 /// <param name="flightParameter"></param>
 /// <param name="extractor"></param>
 /// <param name="currentFlight"></param>
 private void CreateTempCurrentFlight(StorageFile file, FlightDataEntitiesRT.AircraftModel aircraftModel,
     FlightDataEntitiesRT.FlightParameters flightParameter,
     ref FlightDataEntitiesRT.IFlightRawDataExtractor extractor,
     ref FlightDataEntitiesRT.Flight currentFlight)
 {
     if (aircraftModel != null && !string.IsNullOrEmpty(aircraftModel.ModelName))
     {
         if (aircraftModel.ModelName == "F4D")
         {
             var result = FlightDataReading.AircraftModel1.FlightRawDataExtractorFactory
                 .CreateFlightRawDataExtractor(file, flightParameter);
             extractor = result;
         }
     }
     currentFlight = new FlightDataEntitiesRT.Flight()
     {
         Aircraft = new FlightDataEntitiesRT.AircraftInstance()
         {
             AircraftModel = aircraftModel,
             AircraftNumber = "1234", //debug
             LastUsed = DateTime.Now
         },
         StartSecond = 0,
         FlightName = file.Name,
         FlightID = this.RemoveIllegalChars(file.DisplayName)
     };
 }