Пример #1
0
        private void newCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Capture.ChooseForm frm = new Capture.ChooseForm();

            System.Diagnostics.Process[] processes;
            oSpy.Capture.Device[]        devices;
            bool restartDevices;

            if (!frm.GetSelection(out processes, out devices, out restartDevices))
            {
                return;
            }

            captureMgr.RestartDevices = restartDevices;

            if (processes.Length > 0 && devices.Length > 0)
            {
                MessageBox.Show("Capturing from both processes and devices simultaneously is not yet supported.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOperation("Starting capture");
            captureMgr.StartCapture(processes, swForm.GetRules(), devices, curProgress);

            if (curProgress.ShowDialog(this) != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to start capture: {0}", curProgress.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Capture.ProgressForm capProgFrm = new Capture.ProgressForm(captureMgr);
            capProgFrm.ShowDialog();

            NewOperation("Stopping capture");
            captureMgr.StopCapture(curProgress);

            if (curProgress.ShowDialog(this) != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to stop capture: {0}", curProgress.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOperation("Processing capture");
            curProgress = new ProgressForm(curOperation);
            dumpBuilder.BuildAsync(captureMgr.CapturePath, captureMgr.EventCount, curOperation);

            curProgress.ShowDialog(this);
        }
Пример #2
0
        private void newCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Capture.ChooseForm frm = new Capture.ChooseForm();

            System.Diagnostics.Process[] processes;
            oSpy.Capture.Device[] devices;
            bool restartDevices;
            if (!frm.GetSelection (out processes, out devices, out restartDevices))
                return;

            captureMgr.RestartDevices = restartDevices;

            if (processes.Length > 0 && devices.Length > 0)
            {
                MessageBox.Show ("Capturing from both processes and devices simultaneously is not yet supported.",
                                 "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOperation("Starting capture");
            captureMgr.StartCapture(processes, swForm.GetRules(), devices, curProgress);

            if (curProgress.ShowDialog(this) != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to start capture: {0}", curProgress.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Capture.ProgressForm capProgFrm = new Capture.ProgressForm(captureMgr);
            capProgFrm.ShowDialog();

            NewOperation("Stopping capture");
            captureMgr.StopCapture(curProgress);

            if (curProgress.ShowDialog(this) != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to stop capture: {0}", curProgress.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOperation("Processing capture");
            curProgress = new ProgressForm(curOperation);
            dumpBuilder.BuildAsync(captureMgr.CapturePath, captureMgr.EventCount, curOperation);

            curProgress.ShowDialog(this);
        }
Пример #3
0
        private void newCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Capture.ChooseForm frm = new Capture.ChooseForm();

            Process[] processes = frm.GetSelectedProcesses();
            if (processes.Length == 0)
                return;

            ProgressForm progFrm = new ProgressForm("Starting capture");

            captureMgr.StartCapture(processes, progFrm);

            if (progFrm.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to start capture: {0}", progFrm.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Capture.ProgressForm capProgFrm = new Capture.ProgressForm(captureMgr);
            capProgFrm.ShowDialog();

            progFrm = new ProgressForm("Stopping capture");

            captureMgr.StopCapture(progFrm);

            if (progFrm.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to stop capture: {0}", progFrm.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                captureMgr.SaveCapture(saveFileDialog.FileName);
            }
            else
            {
                captureMgr.DiscardCapture();
            }

            #if false
            tmpEventList.Clear();
            tmpPacketList.Clear();

            captureStartMenuItem.Enabled = false;

            object source = dataGridView.DataSource;
            dataGridView.DataSource = null;

            CaptureForm frm = new CaptureForm(listener, swForm.GetRules());
            frm.ShowDialog(this);

            dataGridView.DataSource = null;

            ProgressForm progFrm = new ProgressForm("Analyzing data");

            Thread th = new Thread(new ParameterizedThreadStart(DoPostAnalysis));
            th.Start(progFrm);

            progFrm.ShowDialog(this);
            #endif
        }