private void btn_RunTest2_Click(object sender, EventArgs e) { try { UC_Info uc = new UC_Info(); uc.Dock = DockStyle.Fill; Frm_TemplateDefault frm = new Frm_TemplateDefault(uc); frm.titleCustom.Text = "Test map"; DateTime timeStart = DateTime.Now; if (fctxt_Pattern.Text.Trim() == string.Empty || fctxt_Test.Text.Trim() == string.Empty) { MessageBox.Show("Please, input data Pattern string and Test string", "Run test", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { Style fontTitle = new TextStyle(Brushes.Wheat, null, FontStyle.Bold); Style fontBody = new TextStyle(Brushes.Green, null, FontStyle.Bold); string sReg = fctxt_Pattern.SelectedText; string sString = fctxt_Test.Text; if (string.IsNullOrEmpty(sReg)) { sReg = fctxt_Pattern.Text; } Dictionary <int, RegesValueWithPatternOfGroup> listResult2 = new Dictionary <int, RegesValueWithPatternOfGroup>(); uc.TextCustom.AppendText("Pattern: ", fontTitle); uc.TextCustom.AppendText(sReg + Environment.NewLine, new TextStyle(Brushes.White, null, FontStyle.Bold)); if (Regexs.RunPatternRegular(sString, sReg, out listResult2)) { uc.TextCustom.AppendText("Time: " + (DateTime.Now - timeStart).TotalMilliseconds + " milliseconds ~ " + (DateTime.Now - timeStart).TotalSeconds + " seconds\n", fontTitle); int k = 0; foreach (KeyValuePair <int, RegesValueWithPatternOfGroup> group in listResult2) { k++; uc.TextCustom.AppendText(Environment.NewLine + "Found map: " + k.ToString() + "/" + listResult2.Count.ToString() + Environment.NewLine + "-----------Group var map-----------" + Environment.NewLine, fontTitle); foreach (KeyValuePair <string, Dictionary <int, string> > var in group.Value.value) { uc.TextCustom.AppendText(var.Key + " : " + string.Join(" | ", var.Value.Values.ToArray()) + Environment.NewLine, fontTitle); } uc.TextCustom.AppendText("-----------Map string--------------" + Environment.NewLine, fontTitle); uc.TextCustom.AppendText(group.Value.stringfind + Environment.NewLine, fontBody); } } else { uc.TextCustom.AppendText("Time: " + (DateTime.Now - timeStart).TotalMilliseconds + " milliseconds ~ " + (DateTime.Now - timeStart).TotalSeconds + " seconds\n", fontTitle); uc.TextCustom.AppendText("Not math :(", new TextStyle(Brushes.Red, null, FontStyle.Italic)); } frm.Show(); } } catch (Exception ex) { InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); } }
private void btn_Keyword_Help_Click(object sender, EventArgs e) { try { DataTable cfg_data = sqlite.GetTableDataWith2ColumnName("CfgData", "Type_ID", "8", "Parent_ID", "9"); UC_Info uc = new UC_Info("CfgData", cfg_data.Rows[0]["ID"].ToString(), "Data"); uc.Dock = DockStyle.Fill; Frm_TemplateDefault frm = new Frm_TemplateDefault(uc); frm.titleCustom.Text = "Regular Expression trong C#"; frm.Show(); } catch { } }