Exemplo n.º 1
0
 private void FormConfig_Load(object sender, EventArgs e)
 {
     if (m_filter == null)
     {
         m_filter = new SnifferFilter();
     }
     UpdateFromFilter();
 }
Exemplo n.º 2
0
        void LoadFilters()
        {
            int lastIndex = Application.ExecutablePath.LastIndexOf('\\');

            m_szFiltersPath = Application.ExecutablePath.Remove(lastIndex, Application.ExecutablePath.Length - lastIndex)
                              + "\\filter\\";
            String[] ssf = Directory.GetFiles(m_szFiltersPath, "*.flt");
            comboBoxFilters.Items.Add("NONE");
            for (int i = 0; ssf != null && i < ssf.Length; i++)
            {
                SnifferFilter filter = new SnifferFilter();
                filter.Load(ssf[i]);
                comboBoxFilters.Items.Add(filter);
            }
            comboBoxFilters.Items.Add("New...");
            comboBoxFilters.SelectedIndex = 0;
            toolStripButtonFilter.Enabled = false;
            m_filterCurIndex = 0;
        }
Exemplo n.º 3
0
        private void comboBoxFilters_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxFilters.SelectedIndex != 0 && comboBoxFilters.SelectedIndex != (comboBoxFilters.Items.Count - 1))
            {
                toolStripButtonFilter.Enabled = true;
            }
            else
            {
                toolStripButtonFilter.Enabled = false;
            }

            if (comboBoxFilters.SelectedIndex == 0)
            {
                m_filterCurIndex = comboBoxFilters.SelectedIndex;
                m_filter         = null;
            }
            else if (comboBoxFilters.SelectedIndex == (comboBoxFilters.Items.Count - 1))
            {
                comboBoxFilters.SelectedIndex = m_filterCurIndex;

                FormFilter   formConfig = new FormFilter();
                DialogResult dr         = formConfig.ShowDialog(this);
                if (dr == DialogResult.OK)
                {
                    SnifferFilter filter = formConfig.GetFilter();
                    if (filter != null)
                    {
                        comboBoxFilters.Items.Insert((comboBoxFilters.Items.Count - 2), filter);
                    }
                }
            }
            else
            {
                m_filterCurIndex = comboBoxFilters.SelectedIndex;
                m_filter         = (SnifferFilter)comboBoxFilters.SelectedItem;
            }
        }
Exemplo n.º 4
0
 public void SetFilter(SnifferFilter ft)
 {
     m_filter = ft;
 }