示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var linesCode     = txtCode.Lines.ToList();
            var linesRegexes  = txtRegexes.Lines.ToList();
            var linesReplacer = txtReplacer.Lines.ToList();

            var countArr = new int[] { linesCode.Count, linesRegexes.Count, linesReplacer.Count };

            int maxLineCount = countArr.Max();

            StringBuilder sBuilder = new StringBuilder();

            for (int i = 0; i < maxLineCount; i++)
            {
                string code  = string.Empty;
                string regex = string.Empty;
                string repl  = string.Empty;

                if (i < linesCode.Count && i <= countArr[0])
                {
                    code = linesCode[i];
                }

                if (i < linesRegexes.Count && i <= countArr[1])
                {
                    regex = linesRegexes[i];
                }

                if (i < linesReplacer.Count && i <= countArr[2])
                {
                    repl = linesReplacer[i];
                }

                sBuilder.AppendFormat("{0}\t{1}\t{2}{3}", code, regex, repl, Environment.NewLine);
            }

            NotepadForm saveDlg = new NotepadForm(sBuilder.ToString());

            saveDlg.ShowDialog();
        }
示例#2
0
文件: Form1.cs 项目: windygu/TextTool
        private void button1_Click(object sender, EventArgs e)
        {
            NotepadForm n = new NotepadForm();

            n.ShowDialog();
        }