Beispiel #1
0
        /// <summary>
        /// Starts capturing network packets
        /// </summary>
        /// <param name="filter">Filter to be applied while capturing the packets</param>
        /// <param name="packetLocation">Packets file path</param>
        /// <param name="count">Number of packets to be captured, zero to capture indefinitely</param>
        /// <returns>Unique Identifier</returns>
        public string Start(string filter, string packetLocation, int count)
        {
            // check to see if there is a packets base path configuration in the app.config file
            string basePath = ConfigurationManager.AppSettings["PacketsBaseLocation"];

            TraceFactory.Logger.Info(basePath);

            if (!string.IsNullOrEmpty(packetLocation) && !Path.IsPathRooted(packetLocation))
            {
                if (!string.IsNullOrEmpty(basePath))
                {
                    packetLocation = Path.Combine(basePath, packetLocation);
                }
            }

            TraceFactory.Logger.Info("Started packet capture thru service with parameters filter: '{0}' packet location: '{1}' and count: '{2}'".FormatWith(filter, packetLocation, count));

            return(_networkPackets.StartCapture(filter, packetLocation, count).ToString());
        }