Ejemplo n.º 1
0
        private static IEnumerable <Selection> ReadSelectionFromOptions(SelectorOptions options)
        {
            ITimestampStringConverter timestampConverter = TimestampStringConverterResolver.Default.Resolve(options.TimestampFormat);

            var selection = Selection.Parse(options.FromTimestamp, options.ToTimestamp, timestampConverter);

            return(new[] { selection });
        }
Ejemplo n.º 2
0
        private static void Configure(FilterContext context, SelectorOptions options)
        {
            // read from options or config file
            var selections = Enumerable.Empty <Selection>();

            if (String.IsNullOrWhiteSpace(options.ConfigFilePath))
            {
                selections = ReadSelectionFromOptions(options);
            }
            else
            {
                selections = ReadSelectionsFromConfigFile(context, options.ConfigFilePath);
            }

            if (selections.Any())
            {
                var observers = CreateObserversForSelections(selections, options).ToList();

                observers.ForEach(context.Observers.Add);

                context.GlobalSelection = Selection.Union(selections);
            }
        }
Ejemplo n.º 3
0
        private static object CreateObserversForSelections(IEnumerable <Selection> selections, SelectorOptions options)
        {
            var output = UXI.Filters.Common.FileHelper.DescribeOutput(
                options.OutputFilePath,
                options.OutputFileFormat,
                options.DefaultOutputFileFormat,
                typeof(TimestampedDataPayload),
                Console.Out
                );

            var observer = new FilteringObserver(selection, output);
        }