/// <summary> /// Start a live capture to capture messages. /// </summary> /// <param name="isVerify">Specifies whether to verify the messages during capture. If true, verify the messages during capturing; If false, don't verify the messages.</param> public void StartCapture(bool isVerify = true) { //Set whether verify the messages verifyInLiveCapture = isVerify; if (isVerify) { this.site.Log.Add(LogEntryKind.Comment, "MessageAnalyzerAdapter.StartCapture: If isVerify is true, Make sure the expected Sequence has been loaded."); LoadExpectedSequence(); } //If monitor is not created, create a new monitor. if (monitor == null) { monitor = MessageAnalyzerMonitor.CreateMonitor(null, true); } //If liveCapture is not created, create a new live capture if (liveCapture == null) { // Using default providers if there's no parameter. MMA library will select proper provider according to Windows OS version liveCapture = monitor.CreateLiveTraceSession(); } // If verify the message, parse the message during capturing liveCapture.Start(capturedMessagesSavePath, filter); }
/// <summary> /// Reset the adapter /// </summary> public override void Reset() { base.Reset(); // Reset liveCapture and fileCapture if (liveCapture != null) { liveCapture = null; } if (fileCapture != null) { fileCapture.Dispose(); fileCapture = null; } }
/// <summary> /// Start a live capture to capture messages /// </summary> /// <param name="capturePath">The capture file path</param> /// <param name="filter">The filter applied to the capture</param> public void StartCapture(string capturePath, string filter = null) { //If monitor is not created, create a new monitor. if (monitor == null) { monitor = MessageAnalyzerMonitor.CreateMonitor(null, true); } //If liveCapture is not created, create a new live capture if (liveCapture == null) { // Using default providers if there's no parameter. MMA library will select proper provider according to Windows OS version liveCapture = monitor.CreateLiveTraceSession(); } liveCapture.Start(capturePath, filter); }
/// <summary> /// Dispose /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (liveCapture != null) { liveCapture = null; } if (fileCapture != null) { fileCapture.Dispose(); liveCapture = null; } monitor.Dispose(); } }
/// <summary> /// Reset the adapter /// </summary> public override void Reset() { base.Reset(); // Reset expected Message List expectedMessageList = null; // Reset filter filter = null; // Reset liveCapture and fileCapture if (liveCapture != null) { liveCapture = null; } if (fileCapture != null) { fileCapture.Dispose(); fileCapture = null; } }