Exemplo n.º 1
0
        private void toolStripButtonCompile_Click(object sender, EventArgs e)
        {
            SharpSnifferParser po = (SharpSnifferParser)toolStripComboBoxParser.SelectedItem;
            ParserBase         pp = CompileParserFromFile(po.PathFileName);

            if (pp != null)
            {
                po.Parser = pp;
            }
        }
Exemplo n.º 2
0
        private void toolStripComboBoxParser_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (toolStripComboBoxParser.SelectedIndex <= 0 ||
                toolStripComboBoxParser.SelectedIndex == (toolStripComboBoxParser.Items.Count - 1))
            {
                toolStripButtonCompile.Enabled    = false;
                toolStripButtonEditParser.Enabled = false;
            }
            else
            {
                toolStripButtonCompile.Enabled    = true;
                toolStripButtonEditParser.Enabled = true;
            }

            if (toolStripComboBoxParser.SelectedIndex == (toolStripComboBoxParser.Items.Count - 1))
            {
                toolStripComboBoxParser.SelectedIndex = m_ParserCurIndex;

                //add new
                //
                FormParserEditor editor = new FormParserEditor();
                editor.ShowDialog();
                if (editor.ParserPathFileName.Length != 0)
                {
                    ParserBase         o = editor.ParserCompiled;
                    SharpSnifferParser p = new SharpSnifferParser(editor.ParserPathFileName,
                                                                  Path.GetFileName(editor.ParserPathFileName), o);
                    toolStripComboBoxParser.Items.Insert((toolStripComboBoxParser.Items.Count - 2), p);
                }
            }
            else
            {
                m_ParserCurIndex = toolStripComboBoxParser.SelectedIndex;
                m_parser         = ((SharpSnifferParser)toolStripComboBoxParser.SelectedItem).Parser;
            }
        }