コード例 #1
0
        public SnifferMain()
        {
            InitializeComponent();
			worker = null;
			IsOffline = false;
			OfflineDumpFile = null;
        }
コード例 #2
0
ファイル: SnifferMain.cs プロジェクト: thanhltd/sniffer
 public SnifferMain()
 {
     InitializeComponent();
     worker          = null;
     IsOffline       = false;
     OfflineDumpFile = null;
 }
コード例 #3
0
ファイル: SnifferMain.cs プロジェクト: thanhltd/sniffer
        private void open_file_Click(object sender, EventArgs e)
        {
            // Update tool strip status
            start_cap.Enabled  = false;
            stop_cap.Enabled   = false;
            filter_opt.Enabled = false;
            open_file.Enabled  = false;

            IsOffline = true;

            DialogResult rs = open_dlg.ShowDialog(this);

            OfflineDumpFile = null;
            if (rs == DialogResult.OK)
            {
                string path = open_dlg.FileName;
                OfflineDumpFile = path;

                if (worker == null)
                {
                    worker = new CaptureWorker();
                }

                frames.Items.Clear();
                f_details.Items.Clear();
                h_details.ResetText();

                object[] ctrls = new object[2];
                ctrls[0] = frames;
                ctrls[1] = clear_cap;

                this.Cursor = Cursors.WaitCursor;
                try {
                    PacketSniffer.ResetDetailsDumper();
                }
                catch (Exception) {
                }
                bool status = worker.StartOfflineCapture(path, ctrls);

                if (!status)
                {
                    MessageBox.Show(this, "Bad dump file format", "Sniffer.NET",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                this.Cursor = Cursors.Arrow;
            }

            // Update tool strip status
            if (device_opt.Items.Count != 0)
            {
                start_cap.Enabled = true;
            }
            filter_opt.Enabled = true;
            open_file.Enabled  = true;
        }
コード例 #4
0
ファイル: SnifferMain.cs プロジェクト: thanhltd/sniffer
        private void start_cap_Click(object sender, EventArgs e)
        {
            IsOffline = false;

            int deviceIndex = device_opt.SelectedIndex;

            worker = new CaptureWorker();
            object[] ctrls = new object[2];
            ctrls[0] = frames;
            ctrls[1] = clear_cap;
            worker.StartCapture(deviceIndex, ctrls);

            // Update tool strip status
            stop_cap.Enabled   = true;
            start_cap.Enabled  = false;
            open_file.Enabled  = false;
            save_file.Enabled  = true;
            device_opt.Enabled = false;
        }
コード例 #5
0
		private void open_file_Click(object sender, EventArgs e)
		{
			// Update tool strip status
			start_cap.Enabled = false;
			stop_cap.Enabled = false;
			filter_opt.Enabled = false;
			open_file.Enabled = false;

			IsOffline = true;

			DialogResult rs = open_dlg.ShowDialog(this);

			OfflineDumpFile = null;
			if (rs == DialogResult.OK) {
				string path = open_dlg.FileName;
				OfflineDumpFile = path;

				if (worker == null) {
					worker = new CaptureWorker();
				}

				frames.Items.Clear();
				f_details.Items.Clear();
				h_details.ResetText();

				object[] ctrls = new object[2];
				ctrls[0] = frames;
				ctrls[1] = clear_cap;

				this.Cursor = Cursors.WaitCursor;
				try {
					PacketSniffer.ResetDetailsDumper();
				}
				catch(Exception){
				}
				bool status = worker.StartOfflineCapture(path, ctrls);

				if (!status) {
					MessageBox.Show(this, "Bad dump file format", "Sniffer.NET",
						MessageBoxButtons.OK, MessageBoxIcon.Error);
				}

				this.Cursor = Cursors.Arrow;
			}

			// Update tool strip status
			if (device_opt.Items.Count != 0)
				start_cap.Enabled = true;
			filter_opt.Enabled = true;
			open_file.Enabled = true;
		}
コード例 #6
0
		private void start_cap_Click(object sender, EventArgs e)
		{
			IsOffline = false;

			int deviceIndex = device_opt.SelectedIndex;
			worker = new CaptureWorker();
			object[] ctrls = new object[2];
			ctrls[0] = frames;
			ctrls[1] = clear_cap;
			worker.StartCapture(deviceIndex, ctrls);

			// Update tool strip status
			stop_cap.Enabled = true;
			start_cap.Enabled = false;
			open_file.Enabled = false;
			save_file.Enabled = true;
			device_opt.Enabled = false;
		}