コード例 #1
0
        private void PopulateManeuvers(LogbookEntry le, List <string> lst)
        {
            if (maneuvers == null)
            {
                return;
            }

            foreach (CloudAhoyManeuverDescriptor md in maneuvers)
            {
                CloudAhoyManeuvers maneuver;
                if (Enum.TryParse <CloudAhoyManeuvers>(md.code, out maneuver))
                {
                    switch (maneuver)
                    {
                    case CloudAhoyManeuvers.land:
                    case CloudAhoyManeuvers.stopAndGo:
                        le.Landings++;
                        le.FullStopLandings++;
                        break;

                    case CloudAhoyManeuvers.touchAndGo:
                        le.Landings++;
                        break;

                    case CloudAhoyManeuvers.missedApproach:
                        le.Approaches++;
                        break;

                    case CloudAhoyManeuvers.slowFlight:
                        DictProps[CustomPropertyType.KnownProperties.IDPropManeuverSlowFlight] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropManeuverSlowFlight, true);
                        break;

                    case CloudAhoyManeuvers.chandelle:
                        DictProps[CustomPropertyType.KnownProperties.IDPropManeuverChandelle] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropManeuverChandelle, true);
                        break;

                    case CloudAhoyManeuvers.sTurns:
                        DictProps[CustomPropertyType.KnownProperties.IDPropManeuverSTurns] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropManeuverSTurns, true);
                        break;

                    case CloudAhoyManeuvers.stall:
                        DictProps[CustomPropertyType.KnownProperties.IDPropPowerOffStall] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropPowerOffStall, true);
                        break;

                    case CloudAhoyManeuvers.autoRotate:
                        DictProps[CustomPropertyType.KnownProperties.IDPropAutoRotate] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropAutoRotate, true);
                        break;

                    case CloudAhoyManeuvers.hover:
                        DictProps[CustomPropertyType.KnownProperties.IDPropHover] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropHover, true);
                        break;

                    case CloudAhoyManeuvers.tow:
                        if (!DictProps.ContainsKey(CustomPropertyType.KnownProperties.IDPropGliderTow))
                        {
                            DictProps[CustomPropertyType.KnownProperties.IDPropGliderTow] = PropertyWithValue(CustomPropertyType.KnownProperties.IDPropGliderTow, 0);
                        }
                        DictProps[CustomPropertyType.KnownProperties.IDPropGliderTow].IntValue++;
                        break;

                    default:
                        break;
                    }

                    lst.Add(MarkdownLink(md.label, md.url));
                }
            }
        }
コード例 #2
0
        public override LogbookEntry ToLogbookEntry()
        {
            StringBuilder sb = new StringBuilder();

            if (airports != null)
            {
                foreach (CloudAhoyAirportDescriptor ap in airports)
                {
                    sb.AppendFormat(CultureInfo.CurrentCulture, "{0} ", ap.icao);
                }
            }
            if (aircraft == null)
            {
                aircraft = new CloudAhoyAircraftDescriptor();
            }

            DateTime dtStart = DateTimeOffset.FromUnixTimeSeconds(time).DateTime;

            DictProps.Clear();

            List <string> lstText = new List <string>()
            {
                MarkdownLink(remarks, url)
            };

            PendingFlight le = new PendingFlight()
            {
                FlightID        = LogbookEntry.idFlightNew,
                TailNumDisplay  = aircraft.registration,
                ModelDisplay    = aircraft.model,
                Route           = sb.ToString().Trim(),
                TotalFlightTime = duration / 3600.0M,
                EngineStart     = dtStart,
                EngineEnd       = dtStart.AddSeconds(duration),
                Date            = dtStart.Date
            };

            PopulateCrewInfo(le);
            PopulateManeuvers(le, lstText);

            le.Comment = String.Join(" ", lstText);

            le.CustomProperties = PropertiesWithoutNullOrDefault(DictProps.Values).ToArray();

            if (!string.IsNullOrEmpty(flightId))
            {
                le.PendingID = flightId;
            }

            if (!String.IsNullOrEmpty(UserName))
            {
                le.User = UserName;
                UserAircraft ua = new UserAircraft(UserName);
                Aircraft     ac = ua.GetUserAircraftByTail(le.TailNumDisplay);
                if (ac != null)
                {
                    le.AircraftID = ac.AircraftID;
                }
            }

            return(le);
        }
コード例 #3
0
        public override LogbookEntry ToLogbookEntry()
        {
            StringBuilder sb = new StringBuilder();

            if (airports != null)
            {
                foreach (CloudAhoyAirportDescriptor ap in airports)
                {
                    sb.AppendFormat(CultureInfo.CurrentCulture, "{0} ", ap.icao);
                }
            }
            if (aircraft == null)
            {
                aircraft = new CloudAhoyAircraftDescriptor();
            }

            DateTime dtStart = DateTimeOffset.FromUnixTimeSeconds(time).DateTime;

            DictProps.Clear();

            List <string> lstText = new List <string>()
            {
                MarkdownLink(remarks, link)
            };

            PendingFlight le = new PendingFlight()
            {
                FlightID        = LogbookEntry.idFlightNew,
                TailNumDisplay  = aircraft.registration,
                ModelDisplay    = aircraft.model,
                Route           = sb.ToString().Trim(),
                TotalFlightTime = duration / 3600.0M,
                EngineStart     = dtStart,
                EngineEnd       = dtStart.AddSeconds(duration),
                Date            = dtStart.Date
            };

            PopulateCrewInfo(le);
            PopulateManeuvers(le, lstText);

            le.Comment = String.Join(" ", lstText);

            if (!string.IsNullOrEmpty(flightId))
            {
                le.PendingID = flightId;
            }

            if (!String.IsNullOrEmpty(UserName))
            {
                le.User = UserName;
                Aircraft ac = BestGuessAircraftID(UserName, le.TailNumDisplay);
                if (ac != null)
                {
                    le.AircraftID = ac.AircraftID;
                    if (ac.IsAnonymous)
                    {
                        DictProps[CustomPropertyType.KnownProperties.IDPropAircraftRegistration] = CustomFlightProperty.PropertyWithValue(CustomPropertyType.KnownProperties.IDPropAircraftRegistration, le.TailNumDisplay);
                    }
                }
            }

            le.CustomProperties.SetItems(DictProps.Values);

            return(le);
        }