Example #1
0
 /// <summary>
 /// Opens a file by creating a new NetworkTrace object using provided path.
 /// </summary>
 /// <param name="file">File path to open</param>
 private void OpenFile(string file)
 {
     SetStatusText("Processing " + file);
     try
     {
         NetworkTrace newTrace = new NetworkTrace(file, Filter);
         if (!shutdown && newTrace != null && (!Options.ErrorOnly || newTrace.HasError))
         {
             lock (traceSync)
             {
                 traces.Add(newTrace);
             }
         }
         else
         {
             // If we're not going to keep the trace, Dispose it.  This cleans up event handlers that rooted the object.
             newTrace.Dispose();
         }
     }
     finally
     {
         // Regardless of success or failure, increment our progress and output a new status message.
         Interlocked.Increment(ref currentProgress);
         SetStatusText("Processed " + file);
     }
 }
Example #2
0
 /// <summary>
 /// Checks a Network Trace to determine if it has any messages to show.
 /// </summary>
 /// <param name="trace">Network trace to check</param>
 /// <returns>True if the NetworkTrace has messages to show</returns>
 public bool CheckTrace(NetworkTrace trace)
 {
     if (trace.FilteredMessages.Count > 0)
     {
         return(true);
     }
     return(false);
 }
Example #3
0
        /// <summary>
        /// Raised when a NetworkTrace's filtered message list changes allows us to check the new count and add or remove the item based on it.
        /// </summary>
        /// <param name="sender">NetworkTrace which sent the event</param>
        /// <param name="e">Event arguments</param>
        private void Item_FilteredMessagesChanged(object sender, EventArgs e)
        {
            NetworkTrace trace     = (NetworkTrace)sender;
            bool         isPresent = FilteredTraces.Contains(trace);
            bool         include   = CheckTrace(trace);

            if (isPresent && !include)
            {
                FilteredTraces.Remove(trace);
            }
            else if (!isPresent && include)
            {
                FilteredTraces.Add(trace);
            }
        }