private void toolStripButtonEditParser_Click(object sender, EventArgs e) { FormParserEditor editor = new FormParserEditor(); editor.ParserPathFileName = ((SharpSnifferParser)toolStripComboBoxParser.SelectedItem).PathFileName; editor.ShowDialog(); }
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; } }