void FindInFile(string path) { int mode = comboBoxFind.SelectedIndex;//0 - везде, 1 - в тексте, 2 - в именах полей string raw = File.ReadAllText(path); char[] trim = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ' ' }; int geks = 0; if (path.Contains("_" + main.editTranslation)) { geks = main.geks; } char[] separator = new char[] { ':' }; using (StringReader sr = new StringReader(raw)) { string line; bool first = true; while ((line = sr.ReadLine()) != null) { if (first) { first = false; continue; } string[] split = line.Split(separator, 2); if (split.Length < 2) { continue; } line = TextUtils.FromChars(line, geks); // ехал костыль через костыль string source; switch (mode) { case 1: source = line.Remove(0, split[0].Length); break; case 2: source = split[0]; break; default: source = line; break; } string q = TextUtils.FromChars(TextUtils.ToChars(textBoxFind.Text)); if (Regex.IsMatch(source, q, (checkBoxCase.Checked) ? RegexOptions.None : RegexOptions.IgnoreCase) || Regex.IsMatch(source, textBoxFind.Text, (checkBoxCase.Checked) ? RegexOptions.None : RegexOptions.IgnoreCase)) { ListViewItem item = new ListViewItem(); item.Text = Path.GetFileName(path); item.ToolTipText = path; string field = split[0].TrimStart(' '); item.SubItems.Add(field); item.SubItems.Add(TextUtils.FromChars(split[1].Trim(trim), geks)); results.Add(new Result(item.Text, field, item)); listViewResults.Items.Add(item); statusLabel.Text = MainForm.appLocalisationStrings["formFind_results"] + ": " + listViewResults.Items.Count; } } } }