示例#1
0
        private void LoadPacketCapture()
        {
            var fb         = new OpenFileDialog();
            var showResult = fb.ShowDialog();

            if (showResult == DialogResult.OK || showResult == DialogResult.Yes)
            {
                var filePath = fb.FileName;
                CurrentOutputDir = Path.Combine(TempPacketFolder, Path.GetFileNameWithoutExtension(filePath));

                Directory.CreateDirectory(CurrentOutputDir);

                if (filePath != null)
                {
                    var loader = new PcapLoader(filePath);

                    Packets.Clear();
                    Packets = loader.GetPacketBytes();

                    PacketList.Items.Clear();

                    PacketList.BeginUpdate();
                    foreach (var pct in Packets)
                    {
                        AddPacket(pct);
                    }

                    PacketList.EndUpdate();
                }
            }
        }
示例#2
0
        private async void Button1_Click(object sender, EventArgs e)
        {
            openFileDialog.Multiselect = false;
            openFileDialog.Filter      = "Pcap Dump|*.pcap";
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            PacketList.BeginUpdate();
            await DumpManager.LoadPcap(openFileDialog.FileName, (byte[] message, DateTime time) =>
            {
                parsePacket(message, time, false, true);
            }, new Progress <float>(percent => DumpBox.Text = string.Format("Loading: {0:0.00}%", percent)));

            PacketList.EndUpdate();
        }