FromFiles() public static method

Takes an array of files and creates an observer that retrieves all BinaryEnvelope type events. These Events have EventId 0 and belong to EtwBinaryEventManifestProviderId
public static FromFiles ( ) : IObservable
return IObservable
Esempio n. 1
0
        /// <summary>Notifies the provider that an observer is to receive notifications.</summary>
        /// <returns>A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.</returns>
        /// <param name="observer">The object that is to receive notifications.</param>
        /// <exception cref="System.ArgumentNullException">observer is null.</exception>
        public IDisposable Subscribe(IObserver <IEnvelope> observer)
        {
            if (observer == null)
            {
                throw new ArgumentNullException("observer");
            }

            this.ValidateConfiguration();

            var flattenFiles = this.files
                               .SelectMany(PathUtils.FlattenIfNeeded)
                               .ToArray();

            if (flattenFiles.Length == 0)
            {
                return(Observable.Empty <IEnvelope>()
                       .SubscribeSafe(observer));
            }

            IObservable <IEnvelope> observable;

            if (this.useSequentialReader)
            {
                if (this.startTime.HasValue)
                {
                    observable = BinaryEtwObservable.FromSequentialFiles(
                        this.startTime.Value,
                        this.endTime.Value,
                        flattenFiles);
                }
                else
                {
                    observable = BinaryEtwObservable.FromSequentialFiles(flattenFiles);
                }
            }
            else
            {
                if (this.startTime.HasValue)
                {
                    observable = BinaryEtwObservable.FromFiles(
                        this.startTime.Value,
                        this.endTime.Value,
                        flattenFiles);
                }
                else
                {
                    observable = BinaryEtwObservable.FromFiles(flattenFiles);
                }
            }

            return(observable.SubscribeSafe(observer));
        }
Esempio n. 2
0
        public static void AddBondEtlFiles(this IPlaybackConfiguration playback, params string[] files)
        {
            if (playback == null)
            {
                throw new ArgumentNullException("playback");
            }

            if (files == null)
            {
                throw new ArgumentNullException("files");
            }

            playback.AddInput(() => BinaryEtwObservable.FromFiles(files), typeof(BondJsonEnvelopeTypeMap));
        }