private static void Configure(FilterContext context, BaseFilterOptions options) { ITimestampStringConverter timestampConverter = TimestampStringConverterResolver.Default.Resolve(options.TimestampFormat); if (String.IsNullOrWhiteSpace(options.FromTimestampString) == false) { options.FromTimestamp = timestampConverter.Convert(options.FromTimestampString); } if (String.IsNullOrWhiteSpace(options.ToTimestampString) == false) { options.ToTimestamp = timestampConverter.Convert(options.ToTimestampString); } }
private static IObservable <T> FilterByTimestamps <T>(IObservable <T> data, BaseFilterOptions options) where T : ITimestampedData { var result = data; if (options.FromTimestamp.HasValue) { result = result.SkipWhile(d => d.Timestamp < options.FromTimestamp.Value); } if (options.ToTimestamp.HasValue) { result = result.TakeWhile(d => d.Timestamp < options.ToTimestamp.Value); } return(result); }