Esempio n. 1
0
        public void addtodatagrid(rowObject data)
        {
            bool can_i_add = false;

            if (this.voipDataGridView.Rows.Count == 0)
            {
                can_i_add = true;
            }
            else
            {
                bool is_duplicate = false;
                foreach (DataGridViewRow row in this.voipDataGridView.Rows)
                {
                    if (row.Cells[1].Value.ToString().Equals(data.durationString) &&
                        row.Cells[2].Value.ToString().Equals(data.from) &&
                        row.Cells[3].Value.ToString().Equals(data.to) &&
                        row.Cells[4].Value.ToString().Equals(data.code) &&
                        row.Cells[5].Value.ToString().Equals(data.location)
                        )
                    {
                        is_duplicate = true;
                        break;
                    }
                }
                if (!is_duplicate)
                {
                    can_i_add = true;
                }
            }
            if (can_i_add)
            {
                this.voiptable.Rows.Add(this.voiptable.Rows.Count + 1, data.durationString, data.from, data.to, data.code, data.location);
                this.voipDataGridView.DataSource = this.voiptable;
            }
        }
Esempio n. 2
0
        public void scan_Click(object sender, EventArgs e, MODE _MODE)
        {
            List <string> streamdata = new List <string>();
            bool          hasFile    = this.CurrentFileList.Count > 0;
            bool          hasFolder  = this.CurrentFolderList.Count > 0;

            if (hasFile || hasFolder)
            {
                int sum_result = 0;
                //if (hasFolder)
                //{
                //    Interaction.MsgBox("start scanning folder list", MsgBoxStyle.OkOnly, "scan clicked");
                //    foreach (string folder in this.CurrentFolderList)
                //    {
                //        streamdata.AddRange(this.core.ScanFolder(ref processor, ref err, folder, ref this.audioList));
                //    }
                //}
                if (hasFile)
                {
                    //if(_MODE == MODE.NORMAL) Interaction.MsgBox("start scanning files list", MsgBoxStyle.OkOnly, "scan clicked");
                    foreach (string file in this.CurrentFileList)
                    {
                        if (_MODE == MODE.QUIET)
                        {
                            streamdata.AddRange(this.core.UseFile(ref processor, file, ref err, ref this.audioList, MODE.QUIET));
                        }
                        if (_MODE == MODE.NORMAL)
                        {
                            streamdata.AddRange(this.core.UseFile(ref processor, file, ref err, ref this.audioList, MODE.NORMAL));
                        }
                        //Interaction.MsgBox("tra ve "+ this.core.UseFile(ref processor, file, ref err, ref this.audioList).Count , MsgBoxStyle.OkOnly, " test return 2 cap");
                    }
                }
                sum_result += streamdata.Count;
                string listFileScanned   = "";
                string listFolderScanned = "";
                int    i        = 0;
                int    noFile   = this.CurrentFileList.Count;
                int    noFolder = this.CurrentFolderList.Count;
                for ( ; i < noFile && i < 5; i++)
                {
                    listFileScanned += "\n" + CurrentFileList[i];
                }
                if (noFile > 5)
                {
                    listFileScanned += "\n...";
                }
                for (i = 0; i < noFolder && i < 5; i++)
                {
                    listFolderScanned += "\n" + CurrentFolderList[i];
                }
                if (noFolder > 5)
                {
                    listFolderScanned += "\n...";
                }

                /*if (sum_result > 0) if (_MODE == MODE.NORMAL) Interaction.MsgBox("Scan completed\n" +
                 *  "Found " + sum_result + " streams in folders:" +
                 *  listFolderScanned + "\nAnd files:" +
                 *  listFileScanned
                 *  ,MsgBoxStyle.OkOnly, "Scan sum_result (after word found)"); */
                string audio = "";
                foreach (string audiofile in this.audioList)
                {
                    audio += audiofile + "\n";
                }
                audio += this.audioList.Count.ToString();
                //if (_MODE == MODE.NORMAL) Interaction.MsgBox(audio, MsgBoxStyle.OkOnly, "Audio list from scan_click");
                //if(sum_result == 0 &&_MODE == MODE.NORMAL) Interaction.MsgBox("No stream detected", MsgBoxStyle.OkOnly, "Scan result fail");


                foreach (string data in streamdata)
                {
                    //insert bao datagrid
                    rowObject dataOfAudioFromName = new rowObject(data);
                    this.addtodatagrid(dataOfAudioFromName);
                }
            }

            else if (_MODE == MODE.NORMAL)
            {
                string message1 = "Nothing to scan";
                string message2 = "Do you want to open a pcap file ?";
                chooseFileOrFolderToScan msgbox = new chooseFileOrFolderToScan(message1, message2, this);
                msgbox.ShowDialog();
                //this.scan_Click(sender, err, MODE.NORMAL);
            }
        }