示例#1
0
        private void mFileCaptureMenu_Click(object pSender, EventArgs pArgs)
        {
            if (mCaptureDevice != null)
            {
                mCaptureDevice.Close();
                mCaptureDevice = null;
                return;
            }
            SetupForm frmSetup = new SetupForm();
            if (frmSetup.ShowDialog(this) != DialogResult.OK) return;

            foreach (PcapDevice device in new PcapDeviceList())
            {
                if (device.Interface.FriendlyName == Config.Instance.Interface)
                {
                    mCaptureDevice = device;
                    break;
                }
            }
            mCaptureDevice.Open(true, 1);
            mCaptureDevice.SetFilter(string.Format("tcp portrange {0}-{1}", Config.Instance.LowPort, Config.Instance.HighPort));
        }