예제 #1
0
        public void FilterPackets(string filterText)
        {
            var filters = filterText.Split(',', ';').ToList();

            _destinationFilter = _sourceFilter = _protocolFilter = string.Empty;
            foreach (var filter in filters)
            {
                if (filter.Contains("dest:"))
                {
                    _destinationFilter = new string(filter.Skip(filter.IndexOf(':') + 1).ToArray());
                }
                if (filter.Contains("source:"))
                {
                    _sourceFilter = new string(filter.Skip(filter.IndexOf(':') + 1).ToArray());
                }
                if (filter.Contains("protocol:"))
                {
                    _protocolFilter = new string(filter.Skip(filter.IndexOf(':') + 1).ToArray());
                }
            }

            FilteredPackets.Clear();
            foreach (var p in Packets)
            {
                if (p.Destination.Contains(_destinationFilter) && p.Source.Contains(_sourceFilter) && p.Protocol.ToString().Contains(_protocolFilter))
                {
                    FilteredPackets.Add(p);
                }
            }
        }
예제 #2
0
        private void Filter()
        {
            if (Packets == null || Packets.Count < 1)
            {
                return;
            }

            //Filter Type
            IEnumerable <Packet> filteredList = null;

            FilteredPackets.Clear();
            if (SelectedPacketTypeIndex == 1)
            {
                filteredList = from packet in Packets where packet.Type == PacketType.Client select packet;
            }
            else if (SelectedPacketTypeIndex == 2)
            {
                filteredList = from packet in Packets where packet.Type == PacketType.Server select packet;
            }
            else
            {
                filteredList = from packet in Packets select packet;
            }

            //Filter OpCode
            if (_filterOpCode > 0)
            {
                filteredList = from packet in filteredList where packet.OpCode == _filterOpCode select packet;
            }

            FilteredPackets = new ObservableCollection <Packet>(filteredList);
        }
예제 #3
0
 private void Clear()
 {
     Packets.Clear();
     FilteredPackets.Clear();
 }