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; }
internal static FlightDataEntitiesRT.AircraftInstance FromAircraftService(AircraftService.AircraftInstance one) { if (one != null) { var instance = new FlightDataEntitiesRT.AircraftInstance() { AircraftModel = FromAircraftService(one.AircraftModel), AircraftNumber = one.AircraftNumber, LastUsed = one.LastUsed }; return instance; } return null; }