TXT 文本样式

380,龙骨平原,佐佩爾,we880413@163.com,WoW1

7372,贫瘠之地,悠丶悠,his923@163.com,WoW1

8756,暗影之月,咚巴拉拉,ingi454@163.com,WoW1

根据 TXT 第一个关键字 进行查找

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FindText
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = "C:CZLogs";

            StreamReader sr = new StreamReader(path + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
            String line;
            while ((line = sr.ReadLine()) != null)
            {

                string[] str = line.Split(new char[] { ',' });

                if (str[0] == textBox1.Text)
                {
                    textBox1.Text = str[1];
                    textBox2.Text = str[2];
                    textBox3.Text = str[3];
                    textBox4.Text = str[4];
                    textBox5.Text = str[5];
                }

            }
            sr.Close();
        }
    }
}