コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }