示例#1
0
        private void FormSer2pcap_Load(object sender, EventArgs e)
        {
            if (File.Exists("C:\\Program Files\\Wireshark\\text2pcap.exe") == false)
            {
                MessageBox.Show("Text2pcap.exe not found, please specify the location!");
            }
            else
            {
                Label_text2pcap.Font          = new Font(Label_text2pcap.Font, FontStyle.Regular);
                Label_text2pcap.Text          = "Text2pcap found!";
                TextBox_Text2pcap.Text        = "C:\\Program Files\\Wireshark\\text2pcap.exe";
                Label_arrow_text2pcap.Visible = false;

                Label_select_file.Font = new Font(Label_select_file.Font, FontStyle.Bold);
                Label_select_file.Text = "Select capture file:";

                Label_arror_select_file.Visible = true;
                Label_arror_select_file.Font    = new Font(Label_arror_select_file.Font, FontStyle.Bold);

                TextBox_file.Focus();
                TextBox_file.Select();
            }
        }
示例#2
0
        private void Btn_Select_text2pcap_Click(object sender, EventArgs e)
        {
            OpenFileDialog Select_text2pcap_Dialog = new OpenFileDialog();

            Select_text2pcap_Dialog.Title            = "Select Text2pcap.exe";
            Select_text2pcap_Dialog.Filter           = "Exe files|*.exe";
            Select_text2pcap_Dialog.InitialDirectory = @"C:\Program Files\Wireshark\";
            if (Select_text2pcap_Dialog.ShowDialog() == DialogResult.OK)
            {
                toolStripStatusLabel1.Text = Select_text2pcap_Dialog.FileName;

                string exefilename = Path.GetFileName(Select_text2pcap_Dialog.FileName);

                if (exefilename != "text2pcap.exe")
                {
                    MessageBox.Show("Please sepcifiy the location of text2pcap.exe!\nIt's under Wireshark installation folder");
                    return;
                }
                else
                {
                    Label_text2pcap.Font          = new Font(Label_text2pcap.Font, FontStyle.Regular);
                    Label_text2pcap.Text          = "Text2pcap found!";
                    TextBox_Text2pcap.Text        = "C:\\Program Files\\Wireshark\\text2pcap.exe";
                    Label_arrow_text2pcap.Visible = false;

                    Label_select_file.Font = new Font(Label_select_file.Font, FontStyle.Bold);
                    Label_select_file.Text = "Select capture file:";

                    Label_arror_select_file.Visible = true;
                    Label_arror_select_file.Font    = new Font(Label_arror_select_file.Font, FontStyle.Bold);

                    TextBox_file.Focus();
                    TextBox_file.Select();
                }
            }
        }