Пример #1
0
 public static T Find <T>(this IEnumerable <T> laps, TimeSpan time, RaceEventFlags flagMask = RaceEventFlags.None, PresentationSource?presentationSource = null)
     where T : IHaveRacePassingKey
 {
     return((from l in laps
             where (!presentationSource.HasValue || l.PresentationSource == presentationSource.Value) &&
             l.Flags.HasFlag(flagMask) &&
             !l.Flags.HasFlag(RaceEventFlags.Deleted) &&
             l.Time == time
             select l).FirstOrDefault());
 }
Пример #2
0
        public RacePassingState(Race race, string instanceName, PresentationSource presentationSource, long @where, DateTime @when, TimeSpan time, decimal?passed,
                                decimal?speed, RaceEventFlags flags)
        {
            if (race == null)
            {
                throw new ArgumentNullException(nameof(race));
            }

            Race               = race;
            RaceId             = race.Id;
            InstanceName       = instanceName;
            PresentationSource = presentationSource;
            Where              = @where;
            When               = when;
            Time               = time;
            Passed             = passed;
            Speed              = speed;
            Flags              = flags;
        }
Пример #3
0
        private RaceLapState(Race race, string instanceName, PresentationSource presentationSource, DateTime @when, TimeSpan time, RaceEventFlags flags, decimal?points,
                             decimal?totalPoints, int?index, int?ranking, int?fixedIndex, int?fixedRanking)
        {
            if (race == null)
            {
                throw new ArgumentNullException(nameof(race));
            }

            Race               = race;
            RaceId             = race.Id;
            InstanceName       = instanceName;
            PresentationSource = presentationSource;
            When               = when;
            Time               = time;
            Flags              = flags;
            Points             = points;
            TotalPoints        = totalPoints;
            Index              = index;
            Ranking            = ranking;
            FixedIndex         = fixedIndex;
            FixedRanking       = fixedRanking;
        }
Пример #4
0
 public static T Find <T>(this IEnumerable <T> laps, DateTime when, TimeSpan delta, RaceEventFlags flags = RaceEventFlags.None,
                          PresentationSource?presentationSource = null) where T : IHaveRacePassingKey
 {
     return((from l in laps
             where (!presentationSource.HasValue || l.PresentationSource == presentationSource.Value) &&
             l.Flags.HasFlag(flags) &&
             !l.Flags.HasFlag(RaceEventFlags.Deleted)
             let d = (l.When - when).Duration()
                     where d <= delta
                     orderby d
                     select l).FirstOrDefault());
 }