Exemple #1
0
        private void filtterbutton_Click(object sender, RoutedEventArgs e)
        {
            Filtter f = new Filtter();

            f.Closed += this.filtter_window_close;
            f.Show();
        }
Exemple #2
0
        private void filtter_window_close(object sender, System.EventArgs e)
        {
            Filtter s = (Filtter)sender;

            this.FiltterInfo = s.filtterInfo;
            var ui = new Thread(() => {
                this.Dispatcher.Invoke(new Action(() =>
                {
                    packgelistview.Items.Clear();
                    foreach (Protocol t in this.allitems)
                    {
                        if (this.FiltterInfo.SPort != 0)
                        {
                            if (t.sport != this.FiltterInfo.SPort)
                            {
                                continue;
                            }
                        }
                        if (this.FiltterInfo.DPort != 0)
                        {
                            if (t.dport != this.FiltterInfo.DPort)
                            {
                                continue;
                            }
                        }
                        switch (t.ProtocalType)
                        {
                        case "TCP": if (this.FiltterInfo.TCP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;

                        case "HTTP": if (this.FiltterInfo.TCP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;

                        case "UDP": if (this.FiltterInfo.UDP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;

                        case "ARP": if (this.FiltterInfo.ARP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;

                        case "ICMP": if (this.FiltterInfo.ICMP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;

                        case "IGMP": if (this.FiltterInfo.IGMP == true)
                            {
                                packgelistview.Items.Add(t);
                            }
                            break;
                        }
                    }
                }));
            });

            ui.Start();
            //ui.Join();
        }