/// <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)); }
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(GeneralPartitionableTypeMap)); }
/// <summary> /// Initializes a new instance of the <see cref="BinaryEtwSessionListener"/> class. /// </summary> /// <param name="sessionName">Name of the session.</param> /// <exception cref="ArgumentNullException">sessionName is null</exception> /// <exception cref="ArgumentOutOfRangeException">sessionName;Should not be empty.</exception> public BinaryEtwSessionListener(string sessionName) { if (sessionName == null) { throw new ArgumentNullException("sessionName"); } if (string.IsNullOrEmpty(sessionName)) { throw new ArgumentOutOfRangeException("sessionName", "Should not be empty."); } this.observable = BinaryEtwObservable .FromSession(BinaryEventSource.Log.Guid, sessionName) .Publish() .RefCount(); }