using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; namespace Xylem.Common.Ui.GenesisToolBox { public partial class TextFileMatchControl : UserControl { public Int32 Ident = -1; StringBuilder sb = new StringBuilder(); public TextFileMatchControl(Int32 ident) { InitializeComponent(); setEnabled(); Ident = ident; } private void button2_Click(Object sender, EventArgs e) { saveFileDialog.FileName = txtFileDest.Text; if (saveFileDialog.ShowDialog() == DialogResult.OK) { txtFileDest.Text = saveFileDialog.FileName; } } private void checkBox1_CheckedChanged(Object sender, EventArgs e) { setEnabled(checkBox1.Checked); } private void setEnabled(Boolean enabled = false) { foreach (Control item in groupBox1.Controls) { if (item.Name != "checkBox1") { item.Enabled = enabled; } } } internal void SetMainFile(String text) { txtFileDest.Text = $"{text}_Match{Ident}"; } internal Boolean IsValid() { return checkBox1.Checked & !string.IsNullOrWhiteSpace(textBox1.Text); } internal String Matching() { return textBox1.Text; } List sbAlternative; internal void PrepareRun() { sbAlternative = new List(); } internal List getResult() { return sbAlternative; } internal Boolean AddText(String line) { if (!string.IsNullOrWhiteSpace(txtFilter.Text) && line.Contains(txtFilter.Text)) { return false; } sbAlternative.Add(line); return true; } internal String GetMainFile() { return txtFileDest.Text ; } } }