private void toolStripButtonCompile_Click(object sender, EventArgs e) { SharpSnifferParser po = (SharpSnifferParser)toolStripComboBoxParser.SelectedItem; ParserBase pp = CompileParserFromFile(po.PathFileName); if (pp != null) { po.Parser = pp; } }
private void buttonBuild_Click(object sender, EventArgs e) { if (m_bdirty) { savefile(); } ParserCompiled = CompileParserFromFile(ParserPathFileName); }
void LoadParser() { int lastIndex = Application.ExecutablePath.LastIndexOf('\\'); m_szParsersPath = Application.ExecutablePath.Remove(lastIndex, Application.ExecutablePath.Length - lastIndex) + "\\Parser\\"; String[] ssf = Directory.GetFiles(m_szParsersPath, "*.cs"); toolStripComboBoxParser.Items.Add(new SharpSnifferParser("", "Builtin", new ParserBase())); for (int i = 0; ssf != null && i < ssf.Length; i++) { ParserBase parser = CompileParserFromFile(ssf[i]); toolStripComboBoxParser.Items.Add(new SharpSnifferParser(ssf[i], Path.GetFileName(ssf[i]), parser)); } toolStripComboBoxParser.Items.Add("New..."); toolStripComboBoxParser.SelectedIndex = 0; m_ParserCurIndex = 0; toolStripButtonCompile.Enabled = false; toolStripButtonEditParser.Enabled = false; m_parser = ((SharpSnifferParser)toolStripComboBoxParser.SelectedItem).Parser; }
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; } }
public SharpSnifferParser(String PathfileName, String name, ParserBase parser ) { m_PathFileName = PathfileName; m_Name = name; m_parser = parser; }
public FormParserEditor() { InitializeComponent(); ParserPathFileName = ""; ParserCompiled = null; }