/// <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)); }
public static void AddSequentialBondEtlFiles(this IPlaybackConfiguration playback, params string[] files) { if (playback == null) { throw new ArgumentNullException("playback"); } if (files == null) { throw new ArgumentNullException("files"); } playback.AddInput(() => BinaryEtwObservable.FromSequentialFiles(files), typeof(BondJsonEnvelopeTypeMap)); }